1

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

激活应用程序“Finder”
告诉应用程序“Finder”
    将 theSel 设置为(选择应用程序“Finder”)
    将路径列表设置为 {}
    用 theSel 中的一个项目重复
        将 pathList 的结尾设置为 (POSIX path of (anItem as alias)) 的引号形式
    结束重复
    将 savedDelimiters 设置为 AppleScript 的文本项分隔符
    将 AppleScript 的文本项分隔符设置为“
"
    将剪贴板设置为 pathList 作为字符串
    将 AppleScript 的文本项分隔符设置为 savedDelimiters
结束告诉

唯一的问题是它会导致:

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

这基本上就是我想要的,但我不想要那些该死的单引号。我该如何摆脱它们?我已经尝试删除quoted form of但没有运气。

谢谢!

4

1 回答 1

1

您所要做的就是取出“引用形式的”

    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
于 2011-06-13T15:42:57.963 回答