Applescript Error -1700,无法将〜/ Desktop /变成别名

时间:2015-06-09 04:50:02

标签: macos applescript

set source to (choose folder default location ("~/Desktop/") with multiple selections allowed)
repeat with filetocopy in source
    set n to (quoted form of (POSIX path of filetocopy)) & " "
    set dir to do shell script "dirname " & n
    set bn to do shell script "basename " & n
    set n2 to "." & bn
    set n3 to dir & "/" & n2
    do shell script "mv " & n & space & quoted form of n3
end repeat
display dialog "Folders Hidden!" buttons {"OK"} default button 1

它拒绝将~/变成别名。但是,我不能用我的用户名硬编码路径,因为我正在为朋友发布这个。任何简单的解决方案?

1 个答案:

答案 0 :(得分:1)

你不需要〜/。请改用(Path to desktop)

set source to (choose folder default location (path to desktop) with multiple selections allowed)