Accès aux propriétés des cellules dans iWork Numbers
-
19-08-2019 - |
Question
J'essaie d'accéder à la référence complète d'une cellule dans Applescript. Jusqu'à présent, j'ai réussi à obtenir la référence de cellule et la référence de table à l'aide d'un script tel que:
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
Je n'arrive pas à obtenir la même structure pour obtenir la feuille ou la référence du document. J'ai essayé d'accéder aux propriétés de la cellule et j'obtiens quelque chose comme:
{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}
La propriété de colonne d'une cellule semble donc inclure la référence complète mais si j'accède à la référence directement via la propriété de colonne. Quelqu'un peut-il m'expliquer comment obtenir la feuille et le document en utilisant AppleScript?
A bientôt
Ian
La solution
Vous avez trouvé la solution assez simple tant que le code est dans le bon ordre:
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
Peut utiliser un code similaire pour rechercher le numéro de document