AutoHotKeyで変数代入を自動インデント

  • タグ:
  • タグはありません
Pause::
cb_bk = %ClipboardAll%
Clipboard =
Send, ^c
ClipWait, 2
Sleep, 50
tmp = %Clipboard%
tmp2 = `r`n
;
if tmp = %tmp2%
{
content =
} else if ErrorLevel <> 0
{
; Error
content =
} else {
; \r\n\n\r\n
AutoTrim, off
content = %Clipboard%
StringSplit, OutputArray, content, `n
; 30
if (OutputArray0 > 29) {
Clipboard = %cb_bk%
MsgBox, 30
exit
}
; =
cnt := 1
Loop 30 {
StringGetPos, EQPos%cnt%, OutputArray%cnt%, =
cnt := cnt + 1
if ( OutputArray0 < cnt ) {
break
}
}
; =
cnt := 1
max := 0
Loop 30 {
if (EQPos%cnt% > max) {
max := EQPos%cnt%
}
cnt := cnt + 1
if ( OutputArray0 < cnt ) {
break
}
}
; =
cnt := 1
Loop 30 {
i := max - EQPos%cnt%
Loop %i% {
StringReplace, OutputArray%cnt%, OutputArray%cnt%, =, %A_Space%=
}
cnt := cnt + 1
if ( OutputArray0 < cnt ) {
break
}
}
;
buff =
cnt := 1
Loop 30 {
; \r\n
if (OutputArray0 == cnt) {
StringGetPos, Decision, OutputArray%OutputArray0%, `r
if ( Decision = -1 ) {
buff := buff . OutputArray%cnt%
} else {
buff := buff . OutputArray%cnt% . "`n"
}
} else {
buff := buff . OutputArray%cnt% . "`n"
}
cnt := cnt + 1
if ( OutputArray0 < cnt ) {
break
}
}
Clipboard = %buff%
Send, ^v
Sleep, 20
}
Sleep, 200
Clipboard = %cb_bk%
return
XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX