applescript - 如何在 AppleScript 中通过按键调用 Enter,以便 Web Clipper 将网页保存到 Evernote?

标签 applescript enter automator keystroke evernote

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

我将 Web Clipper 设置为从 $ 开始,F = 整页,输入 = 保存。

我已经做到了实际上有一个有效的事件:

  1. 在 Automator 中创建日历类型的新文档
  2. 添加“获取指定的 URL”和我想要的 URL
  3. 添加“显示网页”
  4. 使用以下代码添加“运行 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.将文档保存在日历事件中并将其设置为重复。

我找到了一些帮助here with a list of key code values但是,我在列表中找不到“输入”。我使用了一个名为 Key Codes 的免费小应用程序相反,要找出 Enter 的 key 代码为 36。

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

最佳答案

我不确定这是否完全符合您的要求,但也许只是击键返回?

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

关于applescript - 如何在 AppleScript 中通过按键调用 Enter,以便 Web Clipper 将网页保存到 Evernote?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/24708464/

相关文章:

javascript - 输入键javascript按键不起作用

java - 无需按 Enter 键即可启用 jcombobox

macos - 如何使用 Automator 调整 Visual Studio Code 窗口的大小?

bash - 如何在单独的自动变量中获得这些结果?

macos - AppleScript 访问网络文件夹

applescript - 如何使用 AppleScript 打开 Siri?

py2app 制作的应用程序中存在 Python 代码

android - 处理键盘上的 Enter 和搜索键

perl - 我可以访问 mac os x automator 中的 __DATA__ 部分吗

macos - 用于打印当前正在运行的所有应用程序的 Bash 命令