Problem with "Messages" AppleScript Events

Discussion in 'OS X Mavericks (10.9)' started by jasonash, Mar 20, 2014.

  1. jasonash macrumors newbie

    Joined:
    Mar 20, 2014
    #1
    Hello,

    I just received a new Macbook Pro today and was frustrated to find that iChat has been removed in leu of Messages in Mavericks.

    On my old Macbook, I had a simple AppleScript set up to fire when someone attempted to chat with me the first time via iChat, but not on subsequent messages. (i.e. someone would send me a message, the script would run, but once the conversation was started it would not fire again). The AppleScript in question would send an SMS to my cell via Twilio with the sender's name and message content. I am often away from my desk at work tending to server racks, etc. and it is nice to get a notification of pending iChat requests.

    It seems like the "text invitation" event on Messages isn't working at all. I can't get the event to trigger anything, no matter what I try.

    Other events, such as "message received", seem to work with no problem. It is just the "text invitation" event that I cannot get to fire.

    Here is my script. It is copied from Apple's included "Speak Events" script.

    Any help would be greatly appreciated. I can also share my Twilio code if anyone is interested.

    Here is the script that I am trying to run via Messages

    Code:
    using terms from application "Messages"
    	on message sent theMessage with eventDescription
    
    	end message sent
    	
    	on message received theMessage with eventDescription
    
    	end message received
    	
    	on chat room message received with eventDescription
    
    	end chat room message received
    	
    	on active chat message received with eventDescription
    
    	end active chat message received
    	
    	on addressed message received theMessage from theBuddy for theChat with eventDescription
    
    	end addressed message received
    	
    	on received text invitation theText from theBuddy for theChat
    		say "someone is calling"
    	end received text invitation
    	
    	on received audio invitation theText from theBuddy for theChat with eventDescription
    
    	end received audio invitation
    	
    	on received video invitation theText from theBuddy for theChat with eventDescription
    
    	end received video invitation
    	
    	on received local screen sharing invitation from theBuddy for theChat with eventDescription
    
    	end received local screen sharing invitation
    	
    	on buddy authorization requested with eventDescription
    
    	end buddy authorization requested
    	
    	on addressed chat room message received with eventDescription
    
    	end addressed chat room message received
    	
    	on received remote screen sharing invitation with eventDescription
    
    	end received remote screen sharing invitation
    	
    	# The following are unused but need to be defined to avoid an error
    	
    	on login finished with eventDescription
    
    	end login finished
    	
    	on logout finished with eventDescription
    
    	end logout finished
    	
    	on buddy became available with eventDescription
    
    	end buddy became available
    	
    	on buddy became unavailable with eventDescription
    
    	end buddy became unavailable
    	
    	on received file transfer invitation theFileTransfer with eventDescription
    
    	end received file transfer invitation
    	
    	on av chat started with eventDescription
    
    	end av chat started
    	
    	on av chat ended with eventDescription
    
    	end av chat ended
    	
    	on completed file transfer with eventDescription
    
    	end completed file transfer
    	
    end using terms from
    Thanks for your time,

    Jason
     
  2. satcomer macrumors 603

    satcomer

    Joined:
    Feb 19, 2008
    Location:
    The Finger Lakes Region
    #2
  3. jasonash thread starter macrumors newbie

    Joined:
    Mar 20, 2014
    #3

Share This Page