提问者:小点点

如何在AppleScript中用击键调用enter,以便Web Clipper将网页保存到Evernote?


最近我发现了Automator(是的,她终于做到了),我想用日历制作一个定期运行的活动。我想使用Safari中的web Clipper扩展将一个特定的网页保存到Evernote。

我将我的Web Clipper设置为从$开始,F=完整页面,enter=保存。

我已经走了这么远,实际上有一个活动,它的工作原理是:

    < li >在Automator中创建日历类型的新文档 < li >添加“获取指定的URL”和我想要的URL < li >添加“显示网页” < li >添加“运行AppleScript ”,代码如下——我对AppleScript一窍不通,所以你可能会说我本可以做得更好...然后告诉;)...:
    tell application "Safari" to activate 
    delay 5
    tell application "System Events"
        keystroke "$" -- key code 10 = Activate Web Clipper (custom shortcut)
    end tell
    delay 1
    tell application "System Events"
        keystroke "f" -- key code 3 = Full page saved by Web Clipper
    end tell
    tell application "System Events"
        key code 36 -- works to save page, however, 'keystroke enter' does not
    end tell

5.将文档保存在日历事件中,并将其设置为重复。

我在这里找到了一些关于关键代码值列表的帮助,但是,我在列表中找不到“enter”。我使用了一个名为Key Codes的免费小应用程序来计算回车键代码为36。

我宁愿能够使用击键,因为它比一些数字更容易阅读。有人能帮忙吗?


共1个答案

匿名用户

我不确定这是否会达到你想要的效果,但也许只是按键返回?

tell application "Safari" to activate
delay 5
tell application "System Events"
    keystroke "$" -- key code 10 = Activate Web Clipper (custom shortcut)
delay 1
    keystroke "f" -- key code 3 = Full page saved by Web Clipper
    keystroke return
end tell