Applescript 访问iWork编号中的单元格属性
我正在尝试访问Applescript中单元格的完整引用。到目前为止,我已成功使用如下脚本获取单元格引用和表引用:Applescript 访问iWork编号中的单元格属性,applescript,iwork,Applescript,Iwork,我正在尝试访问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
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}
因此,单元格的column属性似乎包含完整引用,但如果我直接通过column属性访问引用。
有谁能给我一些指导,告诉我如何使用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
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
可以使用类似的代码检查文档编号找到解决方案,只要代码顺序正确,就相当简单:
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
可以使用类似代码检查文档编号