删除Applescript中“引用形式”的引号?

时间:2011-06-13 15:29:17

标签: macos applescript finder

我有以下代码来复制Finder中多个选定项目的路径:

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,但没有运气。

谢谢!

1 个答案:

答案 0 :(得分: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