使用 AppleScript 操作 Numbers 来帮助组织青少年摔跤比赛:
我的脚本的相关部分如下所示:
-- SELECT THE ROWS
tell document 1
tell active sheet
tell table 1
set WeightClassRows to ¬
((name of first cell of row "3") & ":" & (name of last cell of row EndWeightClass))
set the selection range to range WeightClassRows
end tell
end tell
end tell
到目前为止,它有效。一旦我选择了某些行,我需要复制信息并将其粘贴到其他地方。这有效:
-- COPY THE INFORMATION
tell application "System Events"
keystroke "c" using {command down}
end tell
...
-- PASTE THE INFORMATION SOMEWHERE ELSE
tell application "System Events"
keystroke "v" using {command down, option down, shift down}
end tell
但我更喜欢使用剪贴板来复制信息而不是系统事件。但是,尽管搜索并尝试了很多事情,但我还是无法弄清楚,例如:
set the clipboard to WeightClassRows
set the clipboard to range WeightClassRows
set the clipboard to content of WeightClassRows
set the clipboard to content of selection range
但是这些(或类似的东西)都不起作用。它要么返回单元格引用(“B3:J9”),什么都没有,要么返回一个错误,说“无法获取 B3:J9 的内容”
关于如何使用剪贴板而不是系统事件来复制信息的任何想法?
谢谢!