The new December 2001 Developer CD provides a couple new applescript commands. The most useful one is do shell script [shell commands as string]. This sends commands to the unix-layer without opening a Terminal window. It will also return the result. So, if you want to get a list of files in your Documents folder in long format into a variable, do the following:
set my_doc_list to {do shell script "ls -al ~/Documents"}
The other new command is POSIX path of [mac path]. Sadly, this only does half the job. It does change the ":" delimiters to "/" and adds the "/Volumes/" directory for mounted volumes, but it does not add the escapes for special characters.
If you'd like an AppleScript soubroutine that finishes the job, read the rest of the article. Note: this still can't handle high-bit characters in the path (option-f for instance).
The following subroutine will add the escapes required for special characters in the path:
on unix_path(mac_path)
set unixpath to (POSIX path of mac_path)
set chars to every character of unixpath
repeat with i from 1 to length of chars
if "!$&\"'*(){[|;<>?~` \\" contains (item i of chars as text) then
set item i of chars to "\\" & (item i of chars as text)
end if
end repeat
return every item of chars as string
end unix_path
Mac OS X Hints
http://hints.macworld.com/article.php?story=20011217040113759