google-chrome - 在 URL 中使用 unicode 从 Automator 打开 Chrome 失败
问题描述
我正在使用 Automator 根据一些选定的文本在 Chrome 中打开一个链接:
on run {input, parameters}
set kanji to input as string
set link to "https://jisho.org/search/" & kanji
tell application "Google Chrome"
open location link
end tell
end run
当输入文本是 ASCII 时,这可以正常工作,并且在 URL 处打开一个新的 Chrome 选项卡,但是当输入文本是汉字(例如汉字)时,什么也没有发生(并且放在“try”块中时没有错误)。打开“Safari”总是正常工作,所以这看起来像 Chrome 的东西?
铬 91.0.4472.164,macOS 11.3。
感谢您的任何见解!
更新:感谢行和 gurkensaas。
我最终得到了这个工作版本:
on run {input, parameters}
set kanji to input as string
set link to "https://jisho.org/search/" & kanji
try
tell application "Google Chrome"
tell its window 1
set URL of (make new tab) to link
end tell
end tell
on error errMsg number errorNumber
display dialog "Error occurred: " & errorNumber as text
end try
end run
解决方案
推荐阅读
- postgresql - 如何在 postgresql 中改进此查询?它已经花费了超过 48 小时
- node.js - Stripe 如何防止重复订阅一种产品,如 Google/Apple 订阅
- html - 导航栏中的徽标和菜单未对齐反应引导
- javascript - 如何在使用 redux 时显示 api 调用对组件的响应?
- mysql - 如何将自定义 DATETIME 格式存储到 Mysql DATETIME 字段
- java - 简单查询中的 JavaFX 列名不明确错误
- amazon-web-services - 无服务器 AWS 重新部署错误:S3 存储桶已存在错误,仅适用于特定环境?
- python - 如何按同一组中的多个标准对熊猫数据框中的正负值进行排序?
- amazon-web-services - 在 K8S 上部署 `statefulset` pod 时如何重用 PVC?
- python - SQLITE 记录未更新