Доступ к свойствам ячейки в iWork Numbers - PullRequest
1 голос
/ 18 января 2009

Я пытаюсь получить доступ к полной ссылке на ячейку в 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.

Приветствия

Ian

1 Ответ

1 голос
/ 18 января 2009

Нашли решение, довольно простое, если код находится в правильном порядке:

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

Можно использовать аналогичный код для проверки номера документа

...