On 7/30/09 at 11:48 AM, James Bensley <email@hidden> spake
set current_user to do shell script("whoami")
set file_path to "/Users/" & current_user & /Desktop/MyFile.abc"
set file_path to quoted form of posix path of ((path to "desk" as
text) & "MyFile.abc")
Doesn't launch a shell, accomplishes the same thing in one line and
is more reliable because the resulting path is properly escaped
regarding spaces and other special (shell) characters.
Most importantly, it doesn't hard-code how a user name is mapped to a
pathname. Never hard-code path elements like "/Users/" unless you have
no alternative. And don't assume the user name returned by "whois" is
the name of a directory inside "Users".
"path to" generally supplies the path to common directories.
The other, other AppleScript Chris
Do not post admin requests to the list. They will be ignored.
AppleScript-Users mailing list (email@hidden)
Help/Unsubscribe/Update your Subscription: