スペース区切りデス
スペース区切りデス
; 選択してからPauseキーを押す。(10行まで) Pause:: cb_bk = %ClipboardAll% Clipboard = Send, ^c ClipWait, 2 Sleep, 100 tmp = %Clipboard% tmp2 = `r`n ; 改行しかなかったら終了 if tmp = %tmp2% { content = } else if ErrorLevel <> 0 { ; Error content = } else { ; 初期化 OutputArray1 = OutputArray2 = OutputArray3 = OutputArray4 = OutputArray5 = OutputArray6 = OutputArray7 = OutputArray8 = OutputArray9 = OutputArray10 = i := 1 Loop 10{ arrayOne%i% = i := i + 1 } i := 1 Loop 20{ arrayTwo%i% = i := i + 1 } i := 1 Loop 20{ arrayThree%i% = i := i + 1 } i := 1 Loop 20{ arrayFour%i% = i := i + 1 } i := 1 Loop 20{ arrayFive%i% = i := i + 1 } i := 1 Loop 20{ arraySix%i% = i := i + 1 } i := 1 Loop 20{ arraySeven%i% = i := i + 1 } i := 1 Loop 20{ arrayEight%i% = i := i + 1 } i := 1 Loop 20{ arrayNine%i% = i := i + 1 } i := 1 Loop 20{ arrayTen%i% = i := i + 1 } ; 改行記号で分割。\r\nで分割出来ないみたいなので\nで分割したあと、\rを削る。 AutoTrim, off content = %Clipboard% Sleep, 50 ; 先頭が改行の場合は削り、あとで付け足す。 tmp = StringGetPos, tmp, content, `r beginningOfLineIsReturn = 0 if(tmp = 0) { StringReplace, content, content, `r`n, beginningOfLineIsReturn = 1 } StringSplit, OutputArray, content, `n, `r ; 10行以上だったら中止 if (OutputArray0 > 10) { Clipboard = %cb_bk% MsgBox, ごめん10行くらいまでしか無理 exit } ; 二つ以上の空白があったら一旦一つにする。 arrayOne := RegExReplace( OutputArray1, "( )+", " " ) arrayTwo := RegExReplace( OutputArray2, "( )+", " " ) arrayThree := RegExReplace( OutputArray3, "( )+", " " ) arrayFour := RegExReplace( OutputArray4, "( )+", " " ) arrayFive := RegExReplace( OutputArray5, "( )+", " " ) arraySix := RegExReplace( OutputArray6, "( )+", " " ) arraySeven := RegExReplace( OutputArray7, "( )+", " " ) arrayEight := RegExReplace( OutputArray8, "( )+", " " ) arrayNine := RegExReplace( OutputArray9, "( )+", " " ) arrayTen := RegExReplace( OutputArray10, "( )+", " " ) ; 空白で分割。 StringSplit, arrayOne, arrayOne, %A_Space% StringSplit, arrayTwo, arrayTwo, %A_Space% StringSplit, arrayThree, arrayThree, %A_Space% StringSplit, arrayFour, arrayFour, %A_Space% StringSplit, arrayFive, arrayFive, %A_Space% StringSplit, arraySix, arraySix, %A_Space% StringSplit, arraySeven, arraySeven, %A_Space% StringSplit, arrayEight, arrayEight, %A_Space% StringSplit, arrayNine, arrayNine, %A_Space% StringSplit, arrayTen, arrayTen, %A_Space% j := 1 ; 配列の添字 k := arrayOne0 - 1 ; ループ回数 Loop %k% { ; 一番大きい文字列の長さを求める max := StrLen(arrayOne%j%) if( StrLen(arrayTwo%j%) > max ) { max := StrLen(arrayTwo%j%) } if( StrLen(arrayThree%j%) > max ) { max := StrLen(arrayThree%j%) } if( StrLen(arrayFour%j%) > max ) { max := StrLen(arrayFour%j%) } if( StrLen(arrayFive%j%) > max ) { max := StrLen(arrayFive%j%) } if( StrLen(arraySix%j%) > max ) { max := StrLen(arraySix%j%) } if( StrLen(arraySeven%j%) > max ) { max := StrLen(arraySeven%j%) } if( StrLen(arrayEight%j%) > max ) { max := StrLen(arrayEight%j%) } if( StrLen(arrayNine%j%) > max ) { max := StrLen(arrayNine%j%) } if( StrLen(arrayTen%j%) > max ) { max := StrLen(arrayTen%j%) } ; 行末を半角空白に置換 i := max - StrLen(arrayOne%j%) Loop %i% { arrayOne%j% := RegExReplace( arrayOne%j%, "$", " " ) } i := max - StrLen(arrayTwo%j%) Loop %i% { arrayTwo%j% := RegExReplace( arrayTwo%j%, "$", " " ) } i := max - StrLen(arrayThree%j%) Loop %i% { arrayThree%j% := RegExReplace( arrayThree%j%, "$", " " ) } i := max - StrLen(arrayFour%j%) Loop %i% { arrayFour%j% := RegExReplace( arrayFour%j%, "$", " " ) } i := max - StrLen(arrayFive%j%) Loop %i% { arrayFive%j% := RegExReplace( arrayFive%j%, "$", " " ) } i := max - StrLen(arraySix%j%) Loop %i% { arraySix%j% := RegExReplace( arraySix%j%, "$", " " ) } i := max - StrLen(arraySeven%j%) Loop %i% { arraySeven%j% := RegExReplace( arraySeven%j%, "$", " " ) } i := max - StrLen(arrayEight%j%) Loop %i% { arrayEight%j% := RegExReplace( arrayEight%j%, "$", " " ) } i := max - StrLen(arrayNine%j%) Loop %i% { arrayNine%j% := RegExReplace( arrayNine%j%, "$", " " ) } i := max - StrLen(arrayTen%j%) Loop %i% { arrayTen%j% := RegExReplace( arrayTen%j%, "$", " " ) } j := j + 1 } ; バッファに貼り付けて出力 buff = i := 1 Loop %arrayOne0% { if (i < arrayOne0) { buff := buff . arrayOne%i% . " " } else { buff := buff . arrayOne%i% } i := i + 1 } buff := buff . "`r`n" if( OutputArray0 = 1 ) { Goto, hogehoge } i := 1 Loop %arrayTwo0% { if (i < arrayOne0) { buff := buff . arrayTwo%i% . " " } else { buff := buff . arrayTwo%i% } i := i + 1 } buff := buff . "`r`n" if( OutputArray0 = 2 ) { Goto, hogehoge } i := 1 Loop %arrayThree0% { if (i < arrayOne0) { buff := buff . arrayThree%i% . " " } else { buff := buff . arrayThree%i% } i := i + 1 } buff := buff . "`r`n" if( OutputArray0 = 3 ) { Goto, hogehoge } i := 1 Loop %arrayFour0% { if (i < arrayOne0) { buff := buff . arrayFour%i% . " " } else { buff := buff . arrayFour%i% } i := i + 1 } buff := buff . "`r`n" if( OutputArray0 = 4 ) { Goto, hogehoge } i := 1 Loop %arrayFive0% { if (i < arrayOne0) { buff := buff . arrayFive%i% . " " } else { buff := buff . arrayFive%i% } i := i + 1 } buff := buff . "`r`n" if( OutputArray0 = 5 ) { Goto, hogehoge } i := 1 Loop %arraySix0% { if (i < arrayOne0) { buff := buff . arraySix%i% . " " } else { buff := buff . arraySix%i% } i := i + 1 } buff := buff . "`r`n" if( OutputArray0 = 6 ) { Goto, hogehoge } i := 1 Loop %arraySeven0% { if (i < arrayOne0) { buff := buff . arraySeven%i% . " " } else { buff := buff . arraySeven%i% } i := i + 1 } buff := buff . "`r`n" if( OutputArray0 = 7 ) { Goto, hogehoge } i := 1 Loop %arrayEight0% { if (i < arrayOne0) { buff := buff . arrayEight%i% . " " } else { buff := buff . arrayEight%i% } i := i + 1 } buff := buff . "`r`n" if( OutputArray0 = 8 ) { Goto, hogehoge } i := 1 Loop %arrayNine0% { if (i < arrayOne0) { buff := buff . arrayNine%i% . " " } else { buff := buff . arrayNine%i% } i := i + 1 } buff := buff . "`r`n" if( OutputArray0 = 9 ) { Goto, hogehoge } i := 1 Loop %arrayTen0% { if (i < arrayOne0) { buff := buff . arrayTen%i% . " " } else { buff := buff . arrayTen%i% } i := i + 1 } buff := buff . "`r`n" hogehoge: if (beginningOfLineIsReturn = 1) { Clipboard = `r`n%buff% } else { Clipboard = %buff% } Sleep, 50 Send, ^v Sleep, 50 } Sleep, 200 Clipboard = %cb_bk% return