Удалить цитаты по "цитируемой форме" в Applescript? - PullRequest
0 голосов
/ 13 июня 2011

У меня есть следующий код для копирования путей нескольких выбранных элементов в 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 голосов
/ 13 июня 2011

все, что вам нужно сделать, это вывести "цитируемую форму"

    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
...