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

An iChat paging AppleScript Apps
I wanted a way to know when certain people sent me an instant message when I was away from the computer. I came up with the following simple AppleScript to do just that.

The script (when saved as Stay Open) runs at idle time and checks iChat for a window of a specific title. iChat creates windows named "Chat with John Doe" where "John Doe" is the name as used in your Address Book/Buddy List. When a window appears with the proper name, and a "page" in my case hasn't already been sent, a page is sent as appropriate. Obviously this hint can be expanded, but this served an immediate need and works great!
on idle
  tell application "iChat"
    if (exists window "Chat with John Doe") and 
    (not (exists window "Chat with +12125551212")) then
      send "IM waiting from John Doe" 
      to account id "AIM:+12125551212"
    end if
  end tell
  return 10 -- repeat every x seconds
end idle
[robg adds: I haven't tested this one...]
    •    
  • Currently 2.33 / 5
  You rated: 4 / 5 (3 votes cast)
 
[12,339 views]  

An iChat paging AppleScript | 11 comments | Create New Account
Click here to return to the 'An iChat paging AppleScript' hint
The following comments are owned by whoever posted them. This site is not responsible for what they say.
An iChat paging AppleScript
Authored by: GlowingApple on May 22, '05 05:30:05PM

Since the advent of Panther I have been trying to get script iChat so I can see when a user sends me a message. The long term goal was to create a sort of command prompt with an IM so I can get my IP address, etc via IM. That way if I forget to update my dyndns I can update it remotely by getting my IP through iChat. Of course this is less secure than SSH, but it'll be fun to play with for simple things.

Thanks!

---
Jayson --When Microsoft asks you, "Where do you want to go today?" tell them "Apple."



[ Reply to This | # ]
An iChat paging AppleScript
Authored by: Cameroon on May 22, '05 06:01:56PM
Regarding dyndns, why not use the DNS Update application? It can be set to run as a background daemon at startup. Off-topic, sure, helpful? I hope so.

[ Reply to This | # ]
An iChat paging AppleScript
Authored by: GlowingApple on May 22, '05 05:59:49PM

Do you know if there's any way to get the text of the message sent in that window? I've perused the dictionary, but nothing seems to be what I would need to get the text.

---
Jayson --When Microsoft asks you, "Where do you want to go today?" tell them "Apple."



[ Reply to This | # ]
An iChat paging AppleScript
Authored by: Zee on May 22, '05 07:50:35PM

I don't think there is a direct way to get the text of the window. However, you might be able to do something round-about by sending a "select all" and a "copy" to the window. Then use the contents of the clipboard however you see fit.



[ Reply to This | # ]
An iChat paging AppleScript
Authored by: rmiller021 on May 24, '05 08:56:15PM
you can do it with system events

activate application "iChat"
tell application "System Events"
	tell process "iChat"
		count windows
		get value of text area 1 of scroll area 1 of window 1
	end tell
end tell

where window 1 is the last used window

---
I have no clue what i am doing

[ Reply to This | # ]

An iChat paging AppleScript
Authored by: elmimmo on May 23, '05 04:17:37AM

Unfortunately, this is a USA-only hint, I believe, since AIM does not allow messaging non-USA phone number.



[ Reply to This | # ]
An iChat paging AppleScript
Authored by: MrPhil on May 23, '05 11:34:36AM

re: US only: Why not change the output to send an email to your cell phone or pager? (via shell script or Mail)



[ Reply to This | # ]
An iChat paging AppleScript
Authored by: Zee on May 23, '05 01:31:16PM

Although the example shows an IM going to a cell number, the IM can go anywhere and as one reader suggested can also go to an email address (which can be the email address of your cell phone) - fax yourself if you want, in fact!



[ Reply to This | # ]
add phone number to buddy list
Authored by: LouieNet on May 24, '05 07:21:47PM

It's worth noting for the folks new to this form of messaging that the phone number must first be added to the iChat buddy list. It can be added as a new person from inside iChat, or preferably, it can be selected from the Address Book after the phone number is added to the AIM chat field.

If it's not added, iChat will error with "NSArgumentEvaluationScriptError".

---
G4 cube, 1152M RAM, OS X Server 10.2.8
17" Powerbook G4, 1G RAM, OS X 10.2.8



[ Reply to This | # ]
An iChat paging AppleScript
Authored by: np18 on May 27, '05 07:33:25PM

Is there a way to set the script to text for anyone and not just a specific person? Im new to scripting, and even though I have a good bead on it, the option eludes me.



[ Reply to This | # ]
An iChat paging AppleScript
Authored by: LouieNet on Jun 12, '05 12:46:58PM
Thank you for that script, Zee. It certainly limits the amount of activity to the cell phone especially when one is in a meeting at work. :)

Your script also opens up the possibility of easy pager-type notification when non-iChat event occurs. Think about the things that you might be monitoring and want to get alerts for:

  • calendar alarms to a phone that is not sync'ed to your iCal
  • email from a spouse or a certain client/customer
  • specific events in system.log, ftp.log, secure.log, ipfw.log, virex.log, linksys.log, osxvnc.log, named.log, access_log
  • continued high network usage that may indicate a DOS attach
  • new item in your Drop Box
  • new hint posted here :)
Louie

---
G4 cube, 1.5GB RAM, OS X 10.3.9
17" Powerbook G4, 1G RAM, OS X 10.3.9
Mac mini, 1 GB RAM, OS X 10.3.9

[ Reply to This | # ]