|
Armin's Spot on the Web |
Discussion |
|---|---|
iChat - Ambush offline User
You really want to chat with somebody but is consistently offline, away or idle. He seems to go online occasionally, but of course, you have better things to do than watch the Buddy List all the time. So let your computer do the watching. Copy and paste the following code into Script Editor or open in Script Editor, save the script as application and be sure click on "Stay open" before saving. You can place the Scriptlet in the "Scripts" folder for easy access from iChat. property watchedUser : "" property message : "" property idleTime : 15 on run set watchedUser to first item of chooseChatUser() tell me to activate -- bring to front display dialog "Ambush '" & watchedUser & "' with message:" default answer "Hi there!" set message to text returned of result tell application "iChat" to activate -- bring to front return idleTime end run on idle if watchedUser is not "" and message is not "" then tell application "iChat" set theList to id of every account where status is available end tell if theList contains watchedUser then sendChatMessageToUser(watchedUser) quit end if end if return idleTime end idle on quit set watchedUser to "" set message to "" continue quit end quit on chooseChatUser() tell application "iChat" set theList to id of every account where status is not available return choose from list theList without multiple selections allowed end tell end chooseChatUser on sendChatMessageToUser(userID) tell application "iChat" -- strange workaround because iChat AV Beta returns strange things repeat with a in (every account where id is userID) send message to a end repeat end tell end sendChatMessageToUser This script follows the basic structure any script that idles in background to watch something should follow. The The scriptlet icon will appear in the dock and if you want to cancel the 'ambush' then simply quit the script from the dock or by acticvating it and selecting 'quit' fom the menu. This script only watches for a single user. If you would like to handle several messages waiting for several users, the UI would get a lot more complicated and you would have to change the script to a AppleScript Studio project. There is bug in iChat AV beta that makes the strange construct used in |
|
This page was last updated: Tuesday, November 18, 2003 at 12:44:15 PM Copyright 2010 RSVP - Please Reply Mail me @ arminbatmacdotcom |
|