RE: How do I get the IP address of an interface via applescript?
RE: How do I get the IP address of an interface via applescript?
- Subject: RE: How do I get the IP address of an interface via applescript?
- From: "Reese, Steve" <email@hidden>
- Date: Sun, 12 Oct 2003 21:39:08 -0700
- Thread-topic: How do I get the IP address of an interface via applescript?
The text replace is from Apple's examples site.
with "do shell script" you can get anything into AppleScript.
stevan
set addr to do shell script "ifconfig en0 |grep broadcast"
set addr to my textReplace(addr, "inet ", "")
set x to the offset of " " in addr
set addr to (characters (x - 1) thru 1 of addr) as string
display dialog addr
on textReplace(theText, srchStrng, replStrng)
tell (a reference to AppleScript's text item delimiters)
set {od, contents} to {contents, {srchStrng}}
try
set {textList, contents} to {(text items of theText), {replStrng}}
set {newText, contents} to {(textList as text), od}
return item 1 of result
on error errMsg number errNbr
set contents to od
error errMsg number errNbr
end try
end tell
end textReplace
-----Original Message-----
From: Peter Schwenk [
mailto:email@hidden]
Sent: Sun 10/12/2003 8:19 PM
To: email@hidden
Cc:
Subject: How do I get the IP address of an interface via applescript?
Hello:
I was trying to write a script that only tries to mount a network share
iff the network interface is on a particular subnet, but I've been
unable to get my script to find out what the IP address of an interface
is. The closest I've come is finding some discussion on scripting the
Apple System Profiler, but it didn't work as advertised.
I'm running Mac OS X 10.2.8 (applescript 1.9, i believe). Any pointers
would be gratefully appreciated.
--
- Peter A. Schwenk | Mathematical Sciences
- email@hidden | University of Delaware
- (302) 831-0437 | Newark, DE 19716-2553 USA
_______________________________________________
applescript-users mailing list | email@hidden
Help/Unsubscribe/Archives:
http://www.lists.apple.com/mailman/listinfo/applescript-users
Do not post admin requests to the list. They will be ignored.
_______________________________________________
applescript-users mailing list | email@hidden
Help/Unsubscribe/Archives:
http://www.lists.apple.com/mailman/listinfo/applescript-users
Do not post admin requests to the list. They will be ignored.