从pbcopy获取结果,以便使用applescript将其转换为数组?

从pbcopy获取结果,以便使用applescript将其转换为数组?,applescript,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

我有以下代码从文件中读取内容以打开多个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 尝试 将位置设置为Unicode文本(剪贴板作为记录) 关于错误errMsg 显示对话框errMsg 结束尝试
可能最简单的方法是创建一个bash脚本,该脚本将调用
pbpaste
,然后使用
osascript-e
在其中执行applescript。

如果剪贴板包含行为URL的文本,则可以使用以下脚本检索这些URL:

set locations to paragraphs of (the clipboard as Unicode text)