Applescript:如何从2个应用程序复制粘贴和点击按钮?

时间:2018-01-22 19:09:23

标签: applescript

我需要从Numbers复制一些数据并将其移动到Google Chrome浏览器中的GUI。我需要先粘贴一个按钮才能在粘贴之前打开文本框。现在它只会复制Numbers中的数据,并会抛出错误 tell application "Numbers" to activate tell application "System Events" tell process "Numbers" keystroke "c" using command down end tell end tell delay 0.2 tell application "Google Chrome" to activate tell application "System Events" tell process "Google Chrome" click button "Add a New Value" of application process "Google Chrome" keystroke "v" using command down keystroke return end tell end tell

这是我的剧本:

cursor.moveToFirst();

1 个答案:

答案 0 :(得分:0)

错误消息显示您引用了git push devrepo行中出现的process "Google Chrome" of process "Google Chrome"

click button

相同
tell process "Google Chrome"
   click button

所以

click button of process "Google Chrome"

相同
tell process "Google Chrome"
    click button "Add a New Value" of application process "Google Chrome"

导致语法错误。

解决方案是将行更改为

click button "Add a New Value" of process "Google Chrome" of process "Google Chrome"