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

Set iChat status by Network Location (revisited) Apps
A previous hint was posted offering a script for updating your iChat status based on your subnet or SSID. The script worked as a standalone hidden application. But since many users already use iChatStatus to display song titles from iTunes and such, I've reworked the original script so it too could be chosen from iChatStatus.

Read the rest of the article for the script and process to get it working...

  1. Download and install iChatStatus.
  2. Copy this following code into Script Editor. Update the networks with your own personal settings and save it to "Location by Network.scpt"
    
    -- Use MakeNetwork(Subnet, AirportName, StatusMessage) to add your own networks
    MakeNetwork("192.168.1.", null, "I'm at home")
    MakeNetwork(null, "WireFree", "I'm at work")
    
    -- AppleScript
    property Networks : {}
    
    on MakeNetwork(pSubnet, pAirportName, pStatusMessage)
     
     script Network
      property AirportName : pAirportName
      property Subnet : pSubnet
      property StatusMessage : pStatusMessage
     end script
     
     set Networks to Networks & Network
     
     return Network
     
    end MakeNetwork
    
    tell application "System Events"
     
     set EthernetIPAddress to do shell script ¬
      "ifconfig en0 | awk '/inet / {print $2}'"
     set AirportIPAddress to do shell script ¬
      "ifconfig en1 | awk '/inet / {print $2}'"
     set AirportName to do shell script ¬
     "system_profiler SPAirPortDataType|awk -F\": \" '/Current Wireless Network/{print $2}'"
     
     repeat with Network in Networks
      if Subnet of Network is not null then
       if EthernetIPAddress begins with Subnet of Network then
        return StatusMessage of Network
       end if
       
       if AirportIPAddress begins with Subnet of Network then
        return StatusMessage of Network
       end if
      end if
      
      if AirportName of Network is not null then
       if AirportName is equal to AirportName of Network then
        return StatusMessage of Network
       end if
      end if
      
     end repeat
     
     return "Error: No match"
     
    end tell
  3. Put the "Location by Network.scpt" file in ~/Application Support/iChatStatus
  4. Open System Prefs. Go to iChatStatus, activate it, choose "Location by Network. scpt", set the prefix to empty and click update.
Enjoy!
    •    
  • Currently 1.00 / 5
  • 1
  • 2
  • 3
  • 4
  • 5
  (1 vote cast)
 
[8,364 views]  

Set iChat status by Network Location (revisited) | 8 comments | Create New Account
Click here to return to the 'Set iChat status by Network Location (revisited)' hint
The following comments are owned by whoever posted them. This site is not responsible for what they say.
Set iChat status by Network Location (revisited)
Authored by: inertia186 on May 14, '04 11:01:16AM

Is there a script that can update my iChat status so the exact time index of an exact iTunes track is displayed, such that another user running a similar script can synchronize their iTunes to hear roughly the same thing I'm hearing? That would be so cool!



[ Reply to This | # ]
Set iChat status by Network Location (revisited)
Authored by: jonbauman on May 14, '04 11:24:48AM

Here's a basic one to do that:


tell application "iTunes"
	set theName to name of current track
	set theArtist to artist of current track
	set theMinutes to player position div 60
	set theSeconds to player position mod 60
	
	tell application "iChat"
		set status message to theArtist & ": \"" & theName & "\" (" & theMinutes & ":" & theSeconds & ")"
	end tell
end tell
Writing the script that synchronizes iTunes based on the status message generated by this script is an exercise left to the reader.

---

jon

[ Reply to This | # ]

Set iChat status by Network Location (revisited)
Authored by: DougAdams on May 17, '04 11:06:44AM
Check out Now Playing in iChat AV. It's a stay-open app that monitors iTunes and sticks info in the status message. Feel free to borrow routines from it.

[ Reply to This | # ]
Set iChat status by Network Location (revisited)
Authored by: cyberhomie on May 14, '04 12:26:29PM

How about a script that changes the status base on the Network System Preferences' Location. I have different Locations set up for different places, ie @Home, @Work @the Parents, On the Road (using my bluetooth phone), different dialup providers, access numbers, etc. I would be nicer/easier/smarter for me to set status based on the OS' Location feature.

Any suggestions?



[ Reply to This | # ]
Set iChat status by Network Location (revisited)
Authored by: cyberhomie on May 14, '04 12:33:13PM

Ooops -->

"..the status base on the.." - the status base[d] on the

"I would be nicer..." - I[t] would be nicer (yeah it not I, well maybe I would be nicer, too)



[ Reply to This | # ]
Set iChat status by Network Location (revisited)
Authored by: mattshep on May 14, '04 03:13:15PM

You can make some minor adjustments to my posted script and get it to search based on location. Just add a LocationName property to the Network. The key line is determining what the current network location is. I think this should work.

[code]
set LocationName to do shell script "scselect 2>&1 | grep '^ ' 2>&1 | grep '*' | cut -f 2 -d '(' | cut -f 1 -d ')'"
[/code]



[ Reply to This | # ]
Set iChat status by Network Location (revisited)
Authored by: cyberhomie on May 14, '04 03:54:25PM

Can't seem to get it to work.



[ Reply to This | # ]
Set iChat status by Network Location (revisited)
Authored by: mattshep on May 14, '04 08:43:59PM


property Locations : {"Home", "Work", "Automatic"}
property Messages : {"@home", "@work", "?"}

tell application "System Events"
	
	set Location to do shell script "scselect 2>&1 | grep '^ ' 2>&1 | grep '*' | cut -f 2 -d '(' | cut -f 1 -d ')'"
	
	repeat with i from 1 to count of Locations
		if Location is item i of Locations then
			return item i of Messages
		end if
	end repeat
	
	return "Error: No match"
	
end tell



[ Reply to This | # ]