Advertisement
Samatter

2ch-tf.au3

Jan 23rd, 2022 (edited)
1,076
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. #pragma compile(Console, True)
  2. #NoTrayIcon
  3.  
  4. If (Not @Compiled) Then
  5.     MsgBox(0, "Error", "This script must be compiled to run correctly.")
  6.     Exit
  7. EndIf
  8.  
  9. Global $sConfigPath = @ScriptDir & "\" & StringTrimRight(@ScriptName, 3) & "ini"
  10. Global $sHotKey = IniRead($sConfigPath, "General", "sHotKey", "{Insert}")
  11.  
  12. If (HotKeySet($sHotKey, "RunScript") = 1) Then
  13.     ConsoleWrite("HotKeySet() called and '" & $sHotKey & "' key registered" & @CRLF)
  14. Else
  15.     ConsoleWrite("HotKeySet() called but '" & $sHotKey & "' key not registered" & @CRLF)
  16. EndIf
  17.  
  18. Global $bActive = False
  19.  
  20. Func RunScript()
  21.     $bActive = Not $bActive
  22.     If ($bActive) Then
  23.         ConsoleWrite("RunScript() called, $bActive is TRUE" & @CRLF)
  24.         Local $iLinesCount = IniRead($sConfigPath, "General", "iLinesCount", "0")
  25.         If ($iLinesCount > 0) Then
  26.             ConsoleWrite("$iLinesCount > 0, triforce started" & @CRLF)
  27.             DrawTF($iLinesCount)
  28.         EndIf
  29.         $bActive = False
  30.         ConsoleWrite("Triforce completed, you can use '" & $sHotKey & "' key again" & @CRLF)
  31.     Else
  32.         ConsoleWrite("RunScript() called, $bActive is FALSE, triforce canceled" & @CRLF)
  33.         HotKeySet($sHotKey)
  34.         Run(@ScriptFullPath)
  35.         Exit
  36.     EndIf
  37. EndFunc
  38.  
  39. Func DrawTF($iCount)
  40.     ; read settings
  41.     Local $sMainChar = ChrW("0x" & IniRead($sConfigPath, "Symbols", "sMainChar", "2206"))
  42.     Local $sSpaceChar = ChrW("0x" & IniRead($sConfigPath, "Symbols", "sSpaceChar", "00A0"))
  43.     Local $iSpaceMult = IniRead($sConfigPath, "Symbols", "iSpaceMult", 2)
  44.     ; construct parts
  45.     Local $sSpaceMult = TextMult($sSpaceChar, $iSpaceMult)
  46.     Local $sSpaceMultMain = $sSpaceMult & $sMainChar
  47.     ; set counters
  48.     Local $iSpaceMultCount = $iCount - 1
  49.     Local $iSpaceMultMainCount = 0
  50.     ; send text into lines
  51.     For $iLineIndex = 0 To $iCount - 1 Step 1
  52.         Send(TextMult($sSpaceMult, $iSpaceMultCount) & $sMainChar & TextMult($sSpaceMultMain, $iSpaceMultMainCount) & "{ENTER}")
  53.         $iSpaceMultCount = $iSpaceMultCount - 1
  54.         $iSpaceMultMainCount = $iSpaceMultMainCount + 1
  55.     Next
  56.     Send("{BACKSPACE}")
  57. EndFunc
  58.  
  59. Func TextMult($sText, $iMult)
  60.     Local $sResult = ""
  61.     For $iIndex = 0 To $iMult - 1 Step 1
  62.         $sResult = $sResult & $sText
  63.     Next
  64.     Return $sResult
  65. EndFunc
  66.  
  67. While True
  68.     Sleep(1000)
  69. WEnd
  70.  
Advertisement
Advertisement
Advertisement
RAW Paste Data Copied
Advertisement