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

878 views Asked by At
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

It refuses to make ~/ into an alias. However, I can't hard-code the path with my username as I am releasing this for friends. Any simple solutions?

1

There are 1 answers

0
Nick Groeneveld On BEST ANSWER

You don't need the ~/. Use (Path to desktop) instead.

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