Change ISP depending on time of day via AppleScript

Mar 16, '06 05:26:00AM

Contributed by: Tilman

Some internet service providers offer cheap rates that are valid only for a certain time period of the day (eg. 6 pm to 8 am). Connect with this script to automatically choose the cheapest (predetermined) ISP:

-- choose the cheapest ISP 
--
-- example for www.arcor.de (March 2006)

set currhour to (hours of (current date))
if ((currhour > 8) and (currhour < 18)) then
  set tel to "01920782"
  display dialog "Good day!" buttons {"cancel"} giving up after 1
else
  set tel to "01920783"
  display dialog "Good night!" buttons {"cancel"} giving up after 1
end if

set string1 to "Dialing " & tel
display dialog string1 buttons {"cancel"} giving up after 2

tell application "Internet Connect"
  get properties of current configuration of application "Internet Connect"
  set usr to "arcor"
  set psw to "internet"
  connect current configuration to telephone number tel as user usr with password psw
end tell
 

[robg adds: I haven't tested this one...]

Comments (0)


Mac OS X Hints
http://hints.macworld.com/article.php?story=20060312231211238