AppleScript名:縦書きリストの縦行がすべて空白であったら縦行を削除 |
use AppleScript version "2.4" use scripting additions use framework "Foundation" set aList to {{" ", "対", "i", "う", "テ"}, {" ", "応", "p", "A", "キ"}, {" ", "バ", "t", "p", "ス"}, {" ", "︱", "の", "p", "ト"}, {" ", "ジ", "﹁", "l", "縦"}, {" ", "ョ", "禁", "e", "書"}, {" ", "ン", "則", "S", "き"}, {" ", "で", "処", "c", "を"}, {" ", "す", "理", "r", "行"}, {" ", "︒", "﹂", " ", " "}} set bList to checkBlankVerticalLine(aList, " ") of me on checkBlankVerticalLine(aList, aBlankChar) set tLen to length of (item 1 of aList) copy aList to bList set hitList to makeRepeatinglList(length of bList, true) of me set aCount to 1 repeat set workList to {} repeat with ii in bList set jj to contents of ii set the end of workList to (item aCount of jj = aBlankChar) end repeat if workList = hitList then repeat with ii from 1 to length of bList set jj to contents of item ii of bList set item ii of bList to removeItemInArray(jj, 1) of me end repeat set tLen to tLen – 1 end if set aCount to aCount + 1 if aCount > tLen then exit repeat end if end repeat return bList end checkBlankVerticalLine on removeItemInArray(aList as list, anItemNo as integer) set anArray to current application’s NSMutableArray’s arrayWithArray:aList anArray’s removeObjectAtIndex:(anItemNo – 1) return anArray as list end removeItemInArray on makeRepeatinglList(hitNum, hitItem) set outList to {} repeat hitNum times set the end of outList to hitItem end repeat return outList end makeRepeatinglList |
More from my site
(Visited 30 times, 1 visits today)