Help with Applescript (beginner)

Discussion in 'Mac Programming' started by georous, Jan 26, 2007.

  1. georous macrumors newbie

    Jan 26, 2007
    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
  2. stealthninja macrumors member


    Aug 15, 2006
    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.
  3. islandmonusvi macrumors newbie


    Nov 29, 2006
    U.S. Virgin Islands
    Check out OSX Automator and Contextual Menu Items...

Share This Page