Pergunta

Eu estou tentando um acesso a referência completa para uma célula em Applescript. Até agora eu consegui obter a referência da célula ea referência tabela usando um script como:

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

Eu não consigo obter a mesma estrutura de trabalho para obter a folha ou a referência do documento. Eu tentei acessar as propriedades da célula e eu obter algo como:

{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}

A propriedade de coluna de uma célula, portanto, parece incluir a referência completa, mas se eu acessar a referência diretamente através da propriedade de coluna. Alguém pode me dar alguma orientação a respeito de como eu recebo a folha e documento usando AppleScript.

Felicidades

Ian

Foi útil?

Solução

encontrou a solução, bastante simples, desde que o código está na ordem certa:

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

Pode usar código semelhante para verificar o número do documento

Licenciado em: CC-BY-SA com atribuição
Não afiliado a StackOverflow
scroll top