View Full Version : Help with Applescript (beginner)

Jan 26, 2007, 09:14 AM
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
set ip_internal to ""
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
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

Jan 29, 2007, 05:56 PM
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.

Jan 30, 2007, 09:10 AM
Check out OSX Automator and Contextual Menu Items...