• Open Menu Close Menu
  • Apple
  • Shopping Bag
  • Apple
  • Mac
  • iPad
  • iPhone
  • Watch
  • TV
  • Music
  • Support
  • Search apple.com
  • Shopping Bag
 

Lists

Open Menu Close Menu
  • Terms and Conditions
  • Lists hosted on this site
  • Email the Postmaster
  • Tips for posting to public mailing lists
Shell Script Not Working from AppleScript Call
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

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

  • Follow-Ups:
    • Re: Shell Script Not Working from AppleScript Call
      • From: Doug McNutt <email@hidden>
    • Re: Shell Script Not Working from AppleScript Call
      • From: Skeeve <email@hidden>
    • Re: Shell Script Not Working from AppleScript Call
      • From: Axel Luttgens <email@hidden>
  • Prev by Date: Can I store element info in a library and access it from other scripts
  • Next by Date: Re: Shell Script Not Working from AppleScript Call
  • Previous by thread: Re: Can I store element info in a library and access it from other scripts
  • Next by thread: Re: Shell Script Not Working from AppleScript Call
  • Index(es):
    • Date
    • Thread