Help with Applescript (beginner)

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

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

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.

MacRumors attracts a broad audience
of both consumers and professionals interested in
the latest technologies and products. We also boast an active community focused on
purchasing decisions and technical aspects of the iPhone, iPod, iPad, and Mac platforms.