AppleScript名:Numbersでセルのカラム幅を自動調整 v2 |
— Created 2018-1-11 by Takaaki Naganoya — 2018 Piyomaru Software use AppleScript version "2.4" use scripting additions use framework "Foundation" –http://piyocast.com/as/archives/5116 tell application "Numbers" tell front document tell sheet 1 set tCount to count every table if tCount = 0 then return tell table 1 set tableWidth to width set cCount to count every column set cWidth to width of every column set aWidth to width –table width set aveWidth to (aWidth – (first item of cWidth)) / (cCount – 1) tell columns 2 thru cCount set width to aveWidth end tell set wList to width of every column end tell if tCount = 1 then return set origCols to count every column of table 1 repeat with i from 2 to tCount if origCols is not equal to (count every column of table i) then display notification "Numbers: Column number is different in Table #" & (i as string) return end if end repeat repeat with i from 2 to tCount tell table i set width to tableWidth end tell set aCount to 1 tell table i repeat with ii from 1 to cCount tell column ii set width to (contents of item ii of wList) end tell end repeat end tell end repeat end tell end tell end tell |
(Visited 253 times, 1 visits today)