Looks like no one’s replied in a while. To start the conversation again, simply ask a new question.

Using applescript to run a whois from an ip address

I need to be able to automatically look up IP addresses to get their location and registration information. I notice the network Utilities, which performs the function well manually, has no dictionary for apple script. Can anyone tell me if and how this could be done by apple script

Thanks

Xserve, Mac OS X (10.4.3)

Posted on Jul 9, 2010 10:19 AM

Reply
5 replies

Jul 9, 2010 5:17 PM in response to Donald Collier1

Thanks yes I have that bit but where does the answer go lol


Like any AppleScript command, the output of the last command is stored in the variable result. In this case the output of the shell command is the result of the do shell script command.
This makes it trivial to assign to any variable for later use, e.g.:

do shell script "whois 1.2.3.4" -- result of command implicitly stored in the result
set myVariableName to the result -- store the result for later use


or, more succinctly:

set myVariableName to (do shell script "whois 1.2.3.4")

(parentheses are optional, but added for clarity)

in the latter example, the command is executed and the result assigned to myVariableName.

The same techniques can be used for any AppleScript command that returns a value.

Using applescript to run a whois from an ip address

Welcome to Apple Support Community
A forum where Apple customers help each other with their products. Get started with your Apple ID.