Applescript 错误 -1700,无法将 ~/Desktop/ 设为别名

Applescript Error -1700, cant make ~/Desktop/ into an alias

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

拒绝将~/设为别名。但是,我不能用我的用户名对路径进行硬编码,因为我正在为朋友发布它。有什么简单的解决办法吗?

你不需要 ~/.请改用 (Path to desktop)

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