AppleScript 使用 Google Chrome 从日历中打开一个 URL 取决于它的第一部分
AppleScript to open a URL from Calendar using Google Chrome depending on the first part of it
我想制作一个 AppleScript,如果 link 的第一部分是 ____,它将在 Chrome 中打开它。
open http://whosebug.com -a "Google Chrome"
我知道了,但是我该怎么做取决于 link 的第一部分。
例如,如果它的第一部分是 https://meet.google.com/xxx-xxxx-xxx
在 Google Chrome 中打开。
xxxxx
每次都会改变。
也欢迎其他解决方案。
不知道 xxx-xxxx-xxx 的值,很难给出准确的答案。我想如果你看看我设置的变量,这段代码应该会给你一个很好的起点来使用
set baseURL to "https://meet.google.com/"
set openURL to "https://meet.google.com/xxx-xxxx-xxx"
if openURL contains baseURL then do shell script "open " & openURL & " -a 'Google Chrome'"
这是一个替代解决方案,在 macOS High Sierra 10.13.6 下测试并且有效:
- Automator > New > Service
- 使用设置:服务在日历[中接收selected 文本 =56=]
- 添加 运行 Shell 脚本 action,设置:
- Shell: /bin/bash
- 传递输入: 作为参数
- 将默认代码替换为:
open "" -a "Google Chrome"
- 另存为:在Google中打开URL Chrome
然后在日历中,右击URL和select打开URL 在 Google Chrome 中来自 服务 上下文菜单。
这不是单击场景,而是完成工作。
我想制作一个 AppleScript,如果 link 的第一部分是 ____,它将在 Chrome 中打开它。
open http://whosebug.com -a "Google Chrome"
我知道了,但是我该怎么做取决于 link 的第一部分。
例如,如果它的第一部分是 https://meet.google.com/xxx-xxxx-xxx
在 Google Chrome 中打开。
xxxxx
每次都会改变。
也欢迎其他解决方案。
不知道 xxx-xxxx-xxx 的值,很难给出准确的答案。我想如果你看看我设置的变量,这段代码应该会给你一个很好的起点来使用
set baseURL to "https://meet.google.com/"
set openURL to "https://meet.google.com/xxx-xxxx-xxx"
if openURL contains baseURL then do shell script "open " & openURL & " -a 'Google Chrome'"
这是一个替代解决方案,在 macOS High Sierra 10.13.6 下测试并且有效:
- Automator > New > Service
- 使用设置:服务在日历[中接收selected 文本 =56=]
- 添加 运行 Shell 脚本 action,设置:
- Shell: /bin/bash
- 传递输入: 作为参数
- 将默认代码替换为:
open "" -a "Google Chrome"
- 另存为:在Google中打开URL Chrome
然后在日历中,右击URL和select打开URL 在 Google Chrome 中来自 服务 上下文菜单。
这不是单击场景,而是完成工作。