Re: Shell Script Not Working from AppleScript Call
Re: Shell Script Not Working from AppleScript Call
- Subject: Re: Shell Script Not Working from AppleScript Call
- From: Doug McNutt <email@hidden>
- Date: Sun, 24 Aug 2008 13:52:24 -0600
At 00:44 -0700 8/24/08, Rick Gordon wrote:
>--set vPipe to " | "
>--set vCommand to "wget "
>--set vWebAddress to "http://www.edpsciences.org/htbin/ipaddress"
>--set vWgetFlags to " -O - -o de"
>--set vIsolateLine to "grep 'Your IP'"
>--set vRegex to "sed -E 's/^[^0-9]+([0-9]+\\.[0-9]+\\.[0-9]+\\.[0-9]+).*$/\\1/g'"
Quoting with AppleScript is a real booby trap.
AppleScript has "quoted form of" which really helps.
--set vRegex to quoted form of "sed -E 's/^[^0-9]+([0-9]+\\.[0-9]+\\.[0-9]+\\.[0-9]+).*$/\\1/g'"
ought to handle those single quotes and double backslashes which AppleScript is having serious trouble with when it tries to apply them before your shell or sed gets to see them. I'm pretty sure single quotes have to be escaped too. Three or four backslashes in a row are common in the output from quoted form of. (And that really ought to be quoted_form_of, dammit.)
Also with newer versions you might well be dealing with Unicode 16 bit characters after those set instructions something like "as ASCII text" (probably incorrect syntax) might be required these days.
And. . . . The others are right. curl and perl make a nice combination.
--
--> A fair tax is one that you pay but I don't <--
_______________________________________________
Do not post admin requests to the list. They will be ignored.
AppleScript-Users mailing list (email@hidden)
Help/Unsubscribe/Update your Subscription:
Archives: http://lists.apple.com/archives/applescript-users
This email sent to email@hidden