Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #NoEnv ; Recommended for performance and compatibility with future AutoHotkey releases.
- ; #Warn ; Enable warnings to assist with detecting common errors.
- SendMode Input ; Recommended for new scripts due to its superior speed and reliability.
- SetWorkingDir %A_ScriptDir% ; Ensures a consistent starting directory.
- SetTitleMatchMode, 2
- ; ______________________________________________________________________________________
- ; https://autohotkey.com/board/topic/43509-count-number-of-specific-character-in-string/
- ; https://autohotkey.com/board/topic/64454-solved-avoiding-multiple-ifinstring-or-if-with-an-or/
- #If WinActive("メモ帳")
- Enter::
- ClipSaved := Clipboard
- Send, +{home}
- Send, ^c
- Send, {end}
- Send, {Enter}
- Sleep, 100
- line := Clipboard
- StringReplace line,line,`t,`t,UseErrorLevel
- t := ErrorLevel
- tplus := t + 1
- if Instr(line, "{") or Instr(line, ")")
- {
- Loop, %tplus%
- {
- Send, `t
- }
- }
- else
- {
- Loop, %t%
- {
- Send, `t
- }
- }
- Clipboard := ClipSaved
- return
- +[::
- ClipSaved := Clipboard
- Send, +{home}
- Send, ^c
- Send, {end}
- Sleep, 100
- line := Clipboard
- If InStr(line, "if") or InStr(line, "while") or InStr(line, "for")
- {}
- else
- Send, {bs}
- Send, {{}
- Clipboard := ClipSaved
- return
- +]::
- ClipSaved := Clipboard
- Send, +{home}
- Send, ^c
- Send, {end}
- Sleep, 100
- line := Clipboard
- StringReplace line,line,`{,`{,UseErrorLevel
- open := ErrorLevel
- if (open < 1)
- {
- Send, {left}
- Send, {bs}
- Send, {right}
- }
- Send, {}}
- Clipboard := ClipSaved
- return
- #If
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement