Welcome to the MacNN Forums.

If this is your first visit, be sure to check out the FAQ by clicking the link above. You may have to register before you can post: click the register link above to proceed. To start viewing messages, select the forum that you want to visit from the selection below.

You are here: MacNN Forums > Software - Troubleshooting and Discussion > Developer Center > Simple Applescript help (for away message)

Simple Applescript help (for away message)
Thread Tools
SSharon
Professional Poster
Join Date: Jan 2003
Location: Teaneck, NJ
Status: Offline
Reply With Quote
Mar 4, 2005, 04:55 AM
 
My goal is to have a button on my remote control activate an Applescript that pastes text into the frontmost IM window and then send it.

Background: I have my monitor facing my bed so I can watch movies etc., but I want a way to respond to people with an automatic message (but not an away message) if they IM me without me having to get up and go to the keyboard. So one button press should run the script (I am using the ATI remote wonder) and then the script should paste something like "auto message: I am away from my keyboard try calling" or something to that effect.

If I can get that then I can modify the message and apply it to a new button so I can have a few premade responses.
Unfortunately all I can do is tell application AIM to activate and select a window. I was able to have it pop up a dialog box where I could enter text but it just returned it as a result in Applescript since I don't know how to direct it to the IM window and I don't know how to tell it to 'click send'.

If anyone can help I would greatly appreciate it. Or if anyone has any good links that have instructions on how to accomplish what I am trying to do (I don't need really complicated stuff), that would be great as well. Thanks macn.
AT&T iPhone 5S and 6; 13" MBP; MDD G4.
     
Diggory Laycock
Professional Poster
Join Date: Oct 2001
Location: London
Status: Offline
Reply With Quote
Mar 4, 2005, 08:57 AM
 
Here's a really quick and very nasty script to auto-send a message.

I haven't tested it, and it could very well send messages to the wrong people entirely.

But at least it's something to get you going.

Alas iChat's scripting is rather... odd.

'Accounts' appear to refer to buddies, rather than accounts.


[php]
tell application "iChat"
-- get properties

get front document
tell front document
get properties
set docName to name
set stripString to "Instant Message from"
if docName contains stripString then
set IMsender to (characters ((count of stripString) + 2) thru (count of docName) of docName) as string
log (IMsender)
end if
end tell

set i to 0
repeat while i < (count of accounts)
set i to i + 1
if status of account i is not unknown then
get properties of account i
if name of account i is equal to IMsender then
log ("Found a possible sender.")
set senderAccountIndex to i
end if
end if
end repeat


send "AutoReply: Sorry, I'm not available at the moment!" to account senderAccountIndex

end tell
[/php]
     
SSharon  (op)
Professional Poster
Join Date: Jan 2003
Location: Teaneck, NJ
Status: Offline
Reply With Quote
Mar 4, 2005, 12:48 PM
 
Many thanks, I will work with this and see what I get. I have no problem experimenting and sending thousands of messages to people on my buddy list.
AT&T iPhone 5S and 6; 13" MBP; MDD G4.
     
   
 
Forum Links
Forum Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts
BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Top
Privacy Policy
All times are GMT -4. The time now is 12:30 AM.
All contents of these forums © 1995-2017 MacNN. All rights reserved.
Branding + Design: www.gesamtbild.com
vBulletin v.3.8.8 © 2000-2017, Jelsoft Enterprises Ltd.,