构建运行 AppleScript 文件的自动化,将网页的 URL 和标题保存到 Apple Notes,而无需手动操作。
确保已创建或可使用 AppleScript,将网页的 URL 和标题保存到 Apple Notes 中。 您可以查看以下创建 AppleScript 的示例说明,然后可将其用于构建基于 macOS 的自动化:
- 在您的 macOS 设备上,打开脚本编辑器应用程序。
- 创建一个文档并将其命名为 URL capture。
注: 目前仅支持 .applescript 文件格式。
- 在脚本编辑器中,输入脚本:
tell application "Safari"
set myname to name of document 1
set myurl to URL of document 1
end tell
tell application "Notes"
set body of note "inbox" to (get body of note "inbox" & myname & " " & myurl)
end tell
- 单击顶部的播放图标。
显示一个对话框,其中包含当前打开网页的 URL 和标题。
您现在可以使用 URL capture AppleScript 来构建基于 macOS 的自动化。
过程
-
创建自动化。
-
在左侧窗格中,单击自动化。
-
单击 。
-
输入自动化的名称。
在此示例中,输入自动化名称为 AutoURL。
-
单击创建和编辑。
-
使用打开
action 来创建会话并将其链接到 URL capture AppleScript。
-
在自动化中,单击 AutoURL 以在编辑器中打开此自动化。
-
从 AppleScript
package 中双击或拖动打开
action。
-
在会话名称字段中,输入您要创建的会话的名称。
-
在 AppleScript 字段中,选择导入现有文件并单击。
导航到您保存 URL capture AppleScript 的位置。
-
使用运行
action 部署自动化并运行 URL capture AppleScript,以保存网页的 URL 和标题。
-
从 AppleScript
package 中双击或拖动运行
action。
-
在会话名称字段中,输入您在打开
action 中提供的名称。
-
在运行方式字段中,选择完整脚本。
-
AppleScript 运行完成后,使用关闭
action 终止会话。
-
从 AppleScript
package 中双击或拖动关闭
action。
-
在会话名称字段中,输入您在打开
action 中提供的名称。
-
单击保存。
AutoURL 自动化现已链接到 URL capture AppleScript。
-
单击顶部的运行选项以部署自动化。
部署自动化并执行 URL capture AppleScript,将网页的 URL 和标题捕获到 Apple Notes。