Doboy
Doboy

Reputation: 11112

Adding an event listener with applescript

I am trying to do a little hack with the Messages application on OSX Mountain Lion. I am using applescript, but everything I have tried has not been working out for me..

Here is what I tried first

using terms from application "Messages"
   on message sent theObject
        display "it worked!"
   end message sent
end using terms from

But when I press run it just seems to just exit to program immediately. How do I make it stay in listener loop?

Upvotes: 3

Views: 1358

Answers (1)

Doboy
Doboy

Reputation: 11112

I found out the answer to this question... which I believe is completely unintuitive. Basically, first you move the script to ~/Library/Scripts/Messages, then in Messages create an alarm for the event and have the event call the script.

Upvotes: 3

Related Questions