Re: What is the quoted form property of a string?
Re: What is the quoted form property of a string?
- Subject: Re: What is the quoted form property of a string?
- From: Christopher Nebel <email@hidden>
- Date: Fri, 25 Jan 2002 14:57:55 -0800
On Thursday, January 24, 2002, at 04:22 PM, Bill Hoffman wrote:
And how does one reference or access it in a script?
I note that this now works in the 1.8.2 beta release, but I don't know
what
it is. Any help?
The "quoted form" property is intended for use with "do shell script" to
get file names with interesting characters (space, *, parens, etc.) past
the shell intact. If you've got a string (say s), just say "quoted form
of s", and there you go. A typical example would be something like this:
set f to (choose folder)
do shell script "ls -l " & quoted form of POSIX path of f
choose folder returns an alias (stored in f); "POSIX path of f" returns
a string (e.g., "/Users/somebody/Random Stuff", and "quoted form of"
adds quote marks so the shell treats the string literally. For example,
without the quote marks the shell would have interpreted "Random Stuff"
as two parameters separated by a space, not one parameter with a space
in it.
This is fairly useless on Mac OS 9, of course, because there's no shell
to talk to, but it's supported anyway so you can at least look at
scripts designed for Mac OS X.
--Chris Nebel
AppleScript Engineering