Shell Script Not Working from AppleScript Call
Shell Script Not Working from AppleScript Call
- Subject: Shell Script Not Working from AppleScript Call
- From: Rick Gordon <email@hidden>
- Date: Sun, 24 Aug 2008 00:44:26 -0700
The script line that is generated from the following AppleScript works in Terminal, returning the external IP number, but from AppleScript it returns "" without error. I can't figure out why.
The generated string is:
"wget http://www.edpsciences.org/htbin/ipaddress -O - -o /dev/null | grep 'Your IP' | sed -E 's/^[^0-9]+([0-9]+\\.[0-9]+\\.[0-9]+\\.[0-9]+).*$/\\1/g'", which when the excaped backslashes are managed, becomes:
wget http://www.edpsciences.org/htbin/ipaddress -O - -o /dev/null | grep 'Your IP' | sed -E 's/^[^0-9]+([0-9]+\.[0-9]+\.[0-9]+\.[0-9]+).*$/\1/g'
... and runs properly in Terminal.
There is no change between running the commented version broken into bite-sized variables (as commented) and the complete string.
---------
--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'"
--set vGetExternalIPScript to vCommand & vWebAddress & space & vWgetFlags & vPipe & vIsolateLine & vPipe & vRegex
set vGetExternalIPScript to "wget http://www.edpsciences.org/htbin/ipaddress -O - -o /dev/null | grep 'Your IP' | sed -E 's/^[^0-9]+([0-9]+\\.[0-9]+\\.[0-9]+\\.[0-9]+).*$/\\1/g'"
return (do shell script vGetExternalIPScript)
--
___________________________________________________
RICK GORDON
EMERALD VALLEY GRAPHICS AND CONSULTING
___________________________________________________
WWW: http://www.shelterpub.com
_______________________________________________
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