0
如果我在本地或远程服务器上的查找程序中选择一个文件,我希望脚本将POSIX路径作为文本粘贴到剪贴板,以便粘贴在聊天窗口等在Applescript中:将所选文件的POSIX路径复制到剪贴板
这是我迄今为止,但它是不是很干净:
on run
tell application "Finder"
copy selection to theSelected
set outputPathList to {}
set anItem to theSelected
copy (POSIX path of (anItem as alias)) to end of outputPathList
set AppleScript's text item delimiters to return
set outputString to outputPathList as string
set AppleScript's text item delimiters to ""
set the clipboard to outputString
end tell
end run
如何清理它的任何想法?
是否有可能把它输出一个可点击的链接(例如“文件://卷/ SOME_HD /文件夹/文件夹/文件”) –
要获得有关文件方案的网址只是把方案中的前将outputPathList的结尾设置为“file://”的POSIX路径(作为文本的anItem)' – vadian
谢谢。我无法得到我的结尾写字眼。你是一个很好的帮助。 –