Submit Hint Search The Forums LinksStatsPollsHeadlinesRSS
14,000 hints and counting!

Set location and iChat screen name via AppleScript Apps
This really isn't any more than some combinations of hints. It allows one to select a network location. Based on that selection, it sets the network location and then sets an iChat screen name the user wants to use that location. That is, if one selects "work," the script sets the location to "work" and then sets the screen name to your predefined "work" screen name. At the end of the script, I have it launch iChat and Mail and then hide them both. To use this script, one must have the following set up:
  1. their location names have no spaces in them.
  2. Location#x (where x is 1, 2, or 3) is changed to the location name for location #x
  3. screennamex (where x is 1, 2, or 3) is changed to the screen name they want to use at location #x
Read the rest of the hint for the script...

Enter this in Script Editor:
-- user must edit this...any number of locations is possible
-- locations MUST correspond with screennames

set myLocations to {"Location#1", "Location#2", "Location#3"}
set myScreennames to {"screenname1", "screenname2", "screenname3"}

tell application "Finder"
 set loc to (choose from list myLocations with prompt ¬
  "Select your location:" without multiple selections allowed) as string
 if loc is "false" then return
 
 repeat with i from 1 to (count of myLocations)
  if loc is item i of myLocations then
   set nom to quoted form of (item i of myScreennames)
   exit repeat
  end if
 end repeat
end tell

try
 -- note that there MUST be a carriage return 
 -- BEFORE the "defaults" line
 (do shell script ¬
  "scselect " & loc & "
defaults write com.apple.iChat.AIM LoginAs " & nom)
 
 tell application "iChat"
  launch
 end tell
 tell application "Mail"
  launch
 end tell
 
 tell application "System Events"
  if exists application process "iChat" then
   set visible of application process "iChat" to false
  end if
  if exists application process "Mail" then
   set visible of application process "Mail" to false
  end if
 end tell
 
end try
[robg adds: I haven't tested this one myself, but an AppleScript guru friend of mine did -- he tweaked a couple of things, and pronounced it functional.]
    •    
  • Currently 1.00 / 5
  • 1
  • 2
  • 3
  • 4
  • 5
  (1 vote cast)
 
[5,978 views]  

Set location and iChat screen name via AppleScript | 1 comments | Create New Account
Click here to return to the 'Set location and iChat screen name via AppleScript' hint
The following comments are owned by whoever posted them. This site is not responsible for what they say.
Set location and iChat screen name via AppleScript
Authored by: rboisjoly on May 13, '04 12:53:31PM

If you need to automate this type of script, Scenario from the MacChampion Team (http://www.macchampion.com) allows you to run these scripts when specific events occur (wake, sleep, login, idle, etc).

Really cool with iChat!



[ Reply to This | # ]