2011-06-13 39 views
0

我有以下代碼複製在Finder中多項選擇的路徑:在Applescript中刪除「引用格式」中的引號?

 
activate application "Finder" 
tell application "Finder" 
    set theSel to (selection of application "Finder") 
    set pathList to {} 
    repeat with anItem in theSel 
     set the end of pathList to quoted form of (POSIX path of (anItem as alias)) 
    end repeat 
    set savedDelimiters to AppleScript's text item delimiters 
    set AppleScript's text item delimiters to " 
" 
    set the clipboard to pathList as string 
    set AppleScript's text item delimiters to savedDelimiters 
end tell 

唯一的問題是,它導致了這一點:

 
'/Applications/Burn.app/' 
'/Applications/Caffeine.app/' 
'/Applications/Calculator.app/' 

這就是我想基本上是什麼,但我不要那些該死的單引號在那裏。我如何擺脫它們?我已經嘗試刪除quoted form of,但沒有運氣。

謝謝!

回答

0

所有你需要做的就是拿出

activate application "Finder" 
tell application "Finder" 
    set theSel to (selection of application "Finder") 
    set pathList to {} 
    repeat with anItem in theSel 
     set the end of pathList to (POSIX path of (anItem as alias)) 
    end repeat 
    set savedDelimiters to AppleScript's text item delimiters 
    set AppleScript's text item delimiters to " 
" 
    set the clipboard to pathList as string 
    set AppleScript's text item delimiters to savedDelimiters 
end tell 
+0

嗯「的報價表」,我以爲我試過了。也許我有一個錯字。你在編輯蘋果的什麼?我使用了默認編輯器,並且還嘗試了Script Debugger ... – cwd 2011-06-13 15:53:00

+0

我只是使用腳本編輯器一直使用它。我也在運行最新的操作系統 – mcgrailm 2011-06-13 16:20:21