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


Click here to return to the 'Set iChat status according to physical location' hint
The following comments are owned by whoever posted them. This site is not responsible for what they say.
Set iChat status according to physical location
Authored by: crashcane on Apr 15, '04 03:41:06PM
At first, I couldn't get Jon's applescript to work on my iBook (dual USB). The problem seemed to be that it could not get the base station name. So I tried Jason Snell's applescript, and it seemed to be able to identify the connected base station.

The command each script is using to determine the base station is different, with Jon's using ioreg and Jason's using system_profiler.

However, Jason's script doesn't automatically react when you change base-stations, so it has to be run periodically (via cron). So, I started with Jon's script and replaced the code reading:

 set ssid to do shell script "ioreg -n AirPortPCI -S -w 0 | perl -n -e 'print \"$1\\n\" if /\"APCurrentSSID\" = \"(.*)\"/;'"
with the code from Jason's script:
 set ssid to do shell script "system_profiler SPAirPortDataType|awk -F\": \" '/Current Wireless Network/{print $2}'"
Now, I am not sure if this represents the true ssid, but in my situation, it works.

[ Reply to This | # ]
Set iChat status according to physical location
Authored by: jonbauman on Apr 16, '04 08:49:29AM
At first, I couldn't get Jon's applescript to work on my iBook (dual USB). The problem seemed to be that it could not get the base station name.
The command each script is using to determine the base station is different, with Jon's using ioreg and Jason's using system_profiler.

Just out of curiosity, what version of Mac OS are you running and what do you get when you run ioreg -n AirPortPCI -S -w 0? I wrote this script for 10.3.3. I sort of doubt that any difference in perl version would make a difference, but perhaps ioreg's output format has changed. Also the reason I used ioreg instead of system_profiler is because the former runs faster. I did a little test with the time utility. ioreg got

real    0m0.124s
user    0m0.040s
sys     0m0.030s
whereas system_profiler got
real    0m0.801s
user    0m0.160s
sys     0m0.090s
Clearly this is not a real performance issue, but interesting to note. One other thing to mention is that my script would work fine as a cron job executed by osascript rather than as a a stay-open application. The latter just requires more UNIX knowhow.

---

jon

[ Reply to This | # ]

ioreg output on my system
Authored by: crashcane on Apr 16, '04 04:19:18PM
I am using 10.3.3, an apple standard airport(.b) card, and the original Airport basestation.

I don't know a lot about ioreg, but I get the exact same output when I type ioreg -n AirPortPCI -S -w 0 as when I use ioreg -S -w 0. Further, neither of those outputs, nor the output from ioreg -w 0 contain the text "ssid" or "AirPortPCI", which I imagine they do for you. Perhaps it matters what sort of wireless basestation we are connecting to? or something I have misconfigured?

BTW,thanks for sharing your script, as I am really enjoying it.

[ Reply to This | # ]

AirPortPCI vs. AirPortDriver
Authored by: leif on Apr 19, '04 10:01:08PM
On my dual-usb iBook with an (unextreme) AirPort card, there is nothing for AirPortPCI, but there is data for AirPortDriver (you can get the SSID with ioreg -n AirPortDriver|grep APCurrentSSID|cut -d '"' -f 4).

I'd guess you've got 802.11g, or a non-apple 802.11b card ?

[ Reply to This | # ]
Set iChat status according to physical location
Authored by: townsnda on Jul 27, '05 01:33:37PM

ahh hah. changing the set ssid line as per earlier comment

set ssid to do shell script "system_profiler SPAirPortDataType|awk -F\": \" '/Current Wireless Network/{print $2}'"

seems to still work under the new airport driver.



[ Reply to This | # ]
No longer working with new Airport driver?
Authored by: townsnda on Jul 27, '05 01:30:35PM

Has anyone noticed that this script no longer works after the latest Airport driver update?

Seems to be having trouble fetching the current SSID

Not a scripter, so I can't contribute a fix



[ Reply to This | # ]