Become a MacRumors Supporter for $50/year with no ads, ability to filter front page stories, and private forums.

georous

macrumors newbie
Original poster
Jan 26, 2007
1
0
Hi! i'm just taking my first steps into applescript
and i have the following script that displays my ip

to getInternalIP()
set the_interface to 0
repeat
set ip_internal to ""
try
set ip_internal to do shell script ("ipconfig getifaddr en" & the_interface)
end try
if ip_internal is not "" then exit repeat
set the_interface to the_interface + 1
if the_interface = 5 then
set ip_internal to " unknown "
exit repeat
end if
end repeat
return ip_internal
end getInternalIP

set myIP to getInternalIP()
display dialog "Your current IP is: " & myIP buttons "ok" default button "ok"


I wonder how can that be executed automatically when i obtain an ip
or
if there is a way to make my script executable. That's because when i double-click me file it opens the applescript editor first and then i hit "run".

Thank you and i'd appreciate any links to some tutorial or so for applescripting
 

stealthninja

macrumors member
Aug 15, 2006
86
0
MI
in the file menu you can save the script as an applicaion (executable file).
i don't know a way to have it run by itself when you obtain a new ip. you might need a script that runs constantly in the background and checks every so often for a new ip. you could have it run everytime you login to your mac though. hope this helps, i'm not all that experienced with scripting in applescript but i do what i can.
 
Register on MacRumors! This sidebar will go away, and you'll see fewer ads.