从 pbcopy 获取结果并使用 applescript 将它们转换为数组?
我有以下代码来从文件中读取内容以打开多个 Safari 浏览器。
set locations to paragraphs of (read (choose file with prompt "Pick text file containing urls"))
repeat with aLocation in locations
tell application "Safari" to open location aLocation
end repeat
如何从 pbcopy 读取内容(从 Command-C 操作复制的结果)?我尝试如下,但我无法得到线条,但得到字母。
try set the locations to Unicode text of (the clipboard as record) on error errMsg display dialog errMsg end try
I have the following code to read contents from a file to open multiple Safari browsers.
set locations to paragraphs of (read (choose file with prompt "Pick text file containing urls"))
repeat with aLocation in locations
tell application "Safari" to open location aLocation
end repeat
How can I read contents from pbcopy (copied result from Command-C action)? I tried as follows, but I couldn't get the lines, but the alphabets.
try set the locations to Unicode text of (the clipboard as record) on error errMsg display dialog errMsg end try
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
如果剪贴板包含行为 URL 的文本,您可以使用以下脚本检索这些 URL:
If the clipboard contains text whose lines are URLs, you can retrieve those URLs by using the following script:
也许最简单的事情就是制作一个 bash 脚本,该脚本将调用
pbpaste
,然后使用osascript -e
在其中执行 applescript。Probably the easiest thing to do is to make a bash script that will invoke
pbpaste
then useosascript -e
to execute applescript within.