1

Applescript のセルの完全な参照にアクセスしようとしています。これまでのところ、次のようなスクリプトを使用してセル参照とテーブル参照を取得できました。

tell application "Numbers"
tell document 1
repeat with i from 1 to count of sheets
tell sheet i
repeat with j from 1 to count of tables
tell table j
try
set currentCell to the first cell of the selection range
return name of currentCell
end try
end tell
end repeat
end tell
end repeat
end tell
end tell

シートまたはドキュメント参照を取得するために同じ構造を取得できないようです。セルのプロパティにアクセスしようとしましたが、次のような結果が得られました。

{column:column "A" of table "Table 1" of sheet "Sheet 1" of document "Untitled" of
 application "Numbers", alignment:center, value:0.0, background color:{59111, 59111, 
59111}, text color:{0, 0, 0}, font size:10.0, vertical alignment:top, name:"A1",
 class:cell, font name:"HelveticaNeue", format:automatic, row:row "1" of table "Table
 1" of sheet "Sheet 1" of document "Untitled" of application "Numbers", text 
wrap:true}

したがって、セルの列プロパティには完全な参照が含まれているように見えますが、列プロパティを介して直接参照にアクセスすると. applescriptを使用してシートとドキュメントを取得する方法について、誰かが私にガイダンスを教えてくれますか?

乾杯

イアン

4

1 に答える 1

1

コードが正しい順序である限り、かなり単純な解決策を見つけました:

tell application "Numbers"
tell document 1
    repeat with i from 1 to count of sheets
        tell sheet i
            repeat with j from 1 to count of tables
                try
                    tell table j
                        set currentCell to the first cell of the selection range
                        set therow to row of currentCell
                        set sheetNumber to i
                    end tell
                end try
            end repeat
        end tell
    end repeat
    return name of sheet sheetNumber
end tell
end tell

同様のコードを使用してドキュメント番号を確認できます

于 2009-01-18T10:17:21.550 に答える