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: babbletower on Dec 01, '05 07:49:34PM

Just made a "one-liner" that shows the domain I'm are at:

[code]
on idle
tell application "iChat"
set status message to do shell script "/Applications/lynx.command -dump http://www.whatismyip.com | grep Your | awk '{print $4}' | nslookup -silent | grep 'name =' | awk 'BEGIN {FS="."} ; {print "I\047m at "$7"."$8"."$9"."$10}'"
end tell
return 60
end idle
[/code]

Downside is that I depend on Lynx and the whatismyip.com. Lynx can easily be downloaded and there will always be a service similar to whatismyip.com out there, but there must be a simple way to do the same with pure local unix means. Any ideas?

Bo



[ Reply to This | # ]
Set iChat status according to physical location
Authored by: babbletower on Dec 02, '05 12:12:49PM

oh, I just noted that the posted code is missing backshlashes in front of all the quotes (exept the appletalk quotes). Also two backslashed and a xero is missing in front of my 47 (apostrophe) rendering.

I also discovered that I made a little error. I'm printing 7, 8, 9, 10, that should have been 6, 7, 8, 9. So this version doesn't get the precise node that you are on, which might actually be good securitywise... if you want the correct output you should take 6, 7, 8, 9 and remove the arpa name = ... with a awk print dollar 4... you figure is out.

Bo



[ Reply to This | # ]