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
謝謝。我無法得到我的結尾寫字眼。你是一個很好的幫助。 –