Search code examples
macosapplescriptfinder

Remove quotes on "quoted form of" in Applescript?


I have the following code to copy paths of multiple selected items in 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

The only problem is that it results in this:

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

Thats' basically what I want, but I don't want those damn singlue quotes in there. How do I get rid of them? I already tried just removing quoted form of but without luck.

Thanks!


Solution

  • all you have to do is take out "quoted form of "

        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