My_Play_Lists ~BlackCatWhiteTail’s blog~

Talk About My Favorite Songs

applescript+numbers > 繰り返し処理でセルにcell index, cell nameをいれる.

repeat ~ end repeat

準備

tell application "Numbers"
    activate
    set tgtDoc to make new document
    tell tgtDoc
        set tgtSheet to sheet 1
        tell tgtSheet
            delete every table
            set tgtTable to make new table with properties {row count:10, column count:10, header row count:0, header column count:0}
            tell tgtTable
                set height of every row to 36
                set width of every column to 36
                
                -- HERE INSERT CODE (see article below)
                
            end tell
        end tell
    end tell
end tell

repeat構文を用いて各セルにcell indexを入れる.

  • count of cellsで全セル数を取得できる.
  • cell indexでのcell 1は,cell "A1",cell 2はcell "B1"に相当する.
repeat with i from 1 to (count of cells)
    set value of cell i to (i as number)
end repeat

f:id:BlackCatWhiteTail:20200408144052p:plain

各セルにcell nameを入れる.

  • applescriptのナンバーズの"用語説明"の"cell"にはnameがない.
  • しかし,"cell name" で "A1" のようにcell nameが取得できる.
repeat with i from 1 to (count of cells)    
    set value of cell i to (name of cell i)
end repeat

f:id:BlackCatWhiteTail:20200408144017p:plain

[1] https://iworkautomation.com/numbers/range.html AppleScript and Numbers: Ranges https://excel-ubara.com/excelvba1/

[2] ExcelマクロVBA入門:VBAを基礎から学習|エクセルの神髄

 このウェブサイトについて

 練習用のサイトです.

 自分の好きな曲について感想を述べます.

 また,世に役に立つかもと考えたことも書きます.

 

TOP 1 To 5

Title Artist Album
ロックバンド 中村中 私を抱いて下さい
犬の生活 SEX MACHINEGUNS SEX MACHINEGUNS
Megalovania Toby Fox UNDERTALE Soundtrack
Bokura No Fly Away Base Ball Bear Bokura No Fly Away - single
人魚の檻 陰陽座 迦陵頻伽(Ka Ryo Bin Ga