Acceso a las propiedades de las celdas en iWork Numbers
-
19-08-2019 - |
Pregunta
Estoy intentando acceder a la referencia completa de una celda en Applescript. Hasta ahora he logrado obtener la referencia de celda y la referencia de tabla usando un 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
Parece que no puedo obtener la misma estructura para trabajar para obtener la hoja o la referencia del documento. He intentado acceder a las propiedades de la celda y obtengo 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}
La propiedad de columna de una celda, por lo tanto, parece incluir la referencia completa, pero si accedo a la referencia directamente a través de la propiedad de columna. ¿Alguien puede darme alguna orientación sobre cómo obtengo la hoja y el documento usando AppleScript.
Saludos
Ian
Solución
Encontré la solución, bastante simple siempre que el código esté en el orden correcto:
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
Puede usar un código similar para verificar el número de documento