Submit Hint Search The Forums LinksStatsPollsHeadlinesRSS
14,000 hints and counting!


Click here to return to the 'Combining AppleScript variables and UNIX shell scripts' hint
The following comments are owned by whoever posted them. This site is not responsible for what they say.
Combining AppleScript variables and UNIX shell scripts
Authored by: robJ on Aug 07, '03 11:44:33AM
This will likely fail if the thevariable contains a space (bob smith.txt). I usually try to build qualified paths before passing them to the do shell script command. Here's some general info (snipped from a post on Apple's AppleScript forum) regarding paths sent to the shell.

The shell doesn't like traditional Mac paths such as:

"path:to:some:cool file"

It prefers POSIX paths.

POSIX path of "path:to:some:cool file"
Returns: "/path/to/some/cool file"

The shell also dislikes spaces in file/folder names. Using the 'quoted form', you can provide a path in quotes.

quoted form of "/path/to/some/cool file"
Returns: "'/path/to/some/cool file'"

You can put them together for cleaner code.

quoted form of POSIX path of "path:to:some:cool file"
Returns: "'/path/to/some/cool file'"

This will usually escape undesirable characters in a manner that is acceptable to the shell.


[ Reply to This | # ]
Combining AppleScript variables and UNIX shell scripts
Authored by: markuswarren on Aug 07, '03 02:14:35PM

I do agree it's pretty basic applescript stuff, however, some people don't know about it. heck I know a bit about applescript and had not see the 'quoted form' thing, which I'm about to use as i'm going to rewrite some scripts that deal with paths which will include spaces in file names.



[ Reply to This | # ]