以下是一个示例解决方案,演示如何使用AppleScript获取Numbers中的公式和值:
-- 获取Numbers中的公式和值
tell application "Numbers"
activate
tell front document
-- 获取表格的名称
set tableName to name of sheet 1
-- 获取表格的所有单元格
set allCells to cells of every table of sheet 1
-- 遍历所有单元格
repeat with currentCell in allCells
-- 获取单元格的位置
set rowNumber to row index of currentCell
set columnNumber to column index of currentCell
-- 获取单元格的公式和值
set cellFormula to formula of currentCell
set cellValue to value of currentCell
-- 输出单元格的位置、公式和值
display dialog "表格:" & tableName & return & "位置:" & rowNumber & "行," & columnNumber & "列" & return & "公式:" & cellFormula & return & "值:" & cellValue
end repeat
end tell
end tell
请注意,此示例假定Numbers应用程序已经启动并打开了一个文档。还请注意,此示例仅适用于Numbers应用程序,不适用于其他应用程序。您可以根据需要进行修改和调整。