Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #pragma compile(Console, True)
- #NoTrayIcon
- If (Not @Compiled) Then
- MsgBox(0, "Error", "This script must be compiled to run correctly.")
- Exit
- EndIf
- Global $sConfigPath = @ScriptDir & "\" & StringTrimRight(@ScriptName, 3) & "ini"
- Global $sHotKey = IniRead($sConfigPath, "General", "sHotKey", "{Insert}")
- If HotKeySet($sHotKey, "RunScript") Then
- ConsoleWrite("HotKeySet() called and """ & $sHotKey & """ key registered" & @CRLF)
- Else
- ConsoleWrite("HotKeySet() called but """ & $sHotKey & """ key not registered" & @CRLF)
- EndIf
- Global $bActive = False
- Func RunScript()
- $bActive = Not $bActive
- If $bActive Then
- ConsoleWrite("RunScript() called, bActive is TRUE" & @CRLF)
- Local $iLinesCount = IniRead($sConfigPath, "General", "iLinesCount", 0)
- If ($iLinesCount > 0) Then
- ConsoleWrite("iLinesCount is " & $iLinesCount & ", triforce started" & @CRLF)
- DrawTF($iLinesCount)
- EndIf
- $bActive = False
- ConsoleWrite("Triforce completed, you can use """ & $sHotKey & """ key again" & @CRLF)
- Else
- ConsoleWrite("RunScript() called, bActive is FALSE, triforce canceled" & @CRLF)
- HotKeySet($sHotKey)
- Run(@ScriptFullPath)
- Exit
- EndIf
- EndFunc
- Func DrawTF($iCount)
- ; read settings
- Local $sPrefixSpaceB64 = IniRead($sConfigPath, "Symbols", "sPrefixSpaceB64", "")
- Local $sMainSymbolB64 = IniRead($sConfigPath, "Symbols", "sMainSymbolB64", "")
- Local $sMainSpaceB64 = IniRead($sConfigPath, "Symbols", "sMainSpaceB64", "")
- ; decode from base64
- Local $sPrefixSpace = Base64ToUTF8($sPrefixSpaceB64)
- Local $sMainSymbol = Base64ToUTF8($sMainSymbolB64)
- Local $sMainSpace = Base64ToUTF8($sMainSpaceB64)
- ; combine main chunk
- Local $sMainChunk = $sMainSpace & $sMainSymbol
- ; send text into lines
- For $iLineIndex = 1 To $iCount Step 1
- Local $sPrefix = TextMult($sPrefixSpace, $iCount - $iLineIndex)
- Local $sMain = $sMainSymbol & TextMult($sMainChunk, $iLineIndex - 1)
- Send($sPrefix & $sMain & "{ENTER}")
- Next
- Send("{BACKSPACE}")
- EndFunc
- Func TextMult($sText, $iMult)
- Local $sResult = ""
- For $iIndex = 1 To $iMult Step 1
- $sResult = $sResult & $sText
- Next
- Return $sResult
- EndFunc
- Func Base64ToUTF8($Input)
- If (Not $Input) Then
- Return ""
- EndIf
- Local $Struct = DllStructCreate("int")
- $Call = DllCall("Crypt32.dll", "int", "CryptStringToBinary", "str", $Input, "int", 0, "int", 1, "ptr", 0, "ptr", DllStructGetPtr($Struct, 1), "ptr", 0, "ptr", 0)
- If @error Or (Not $Call[0]) Then
- Return ""
- EndIf
- Local $A = DllStructCreate("byte[" & DllStructGetData($Struct, 1) & "]")
- $Call = DllCall("Crypt32.dll", "int", "CryptStringToBinary", "str", $Input, "int", 0, "int", 1, "ptr", DllStructGetPtr($A), "ptr", DllStructGetPtr($Struct, 1), "ptr", 0, "ptr", 0)
- If @error Or (Not $Call[0]) Then
- Return ""
- EndIf
- Return BinaryToString(DllStructGetData($A, 1), 4)
- EndFunc
- While True
- Sleep(1000)
- WEnd
Add Comment
Please, Sign In to add comment