Home » Automation

script to change location

7 August 2007 No Comment

script to change location
– Global property
global set_loc

– Gets current Location
set current_location to do shell script “scselect 2>&1 | grep ‘^ ‘ 2>&1 | grep ‘*’ | cut -f 2 -d ‘(’ | cut -f 1 -d ‘)’”

– checks if it is set to first location and changes to the other one if it is
if current_location is equal to “LOCATION A” then
do shell script “scselect LOCATION B”
set set_loc to “LOCATION B”

– if not then checks to see if it is set to the second location and changes to the other one if it is
else if current_location is equal to “LOCATION B” then
do shell script “scselect LOCATION A”
set set_loc to “LOCATION A”
else
display dialog “You aren’t on either main location. Nothing has been changed.” buttons {”OK”} default button 1
end if

– displays dialog telling which location changed to
display dialog “Location changed to ” & set_loc buttons {”OK”} default button 1

– Dials up.
tell application “Internet Connect”
connect
end tell

Leave your response!

You must be logged in to post a comment.