Page 1 of 1

Sending an iMessage through Messages upon file download.

PostPosted: Wed Oct 31, 2012 12:00 am
by randallpjenkins
I have my rules all set up to move files (I'm using it for TV shows) into folders, and used to use a basic automator email script to send an email when a new show was downloaded. This opened Mail to the front of the computer (which is used as a media server with Plex so it's annoying) and you had to have a workflow for each TV Show.

Recently I've moved away from it and started using Messages to push out a "Notification". It works faster, won't bring up Messages, and in general is a lot cleaner. Anyway I am using an embedded script in Hazel to do this. It's working great, but my AppleScript knowledge is a bit minimal, and I'd love it if I didn't have to change the name of the show for every embedded script and could just pull off the Folder name it's going into (most desired) or the file name. I made an attempt to use theFile but it doesn't seem to like it, thinking it's not in the library for Messages.

I know this isn't as much Hazel help, but scripting help, but I know a lot of you are great at it. I will also gladly provide any info on my streamlined system I have. It's awesome.

Re: Sending an iMessage through Messages upon file download.

PostPosted: Wed Oct 31, 2012 11:26 am
by Mr_Noodle
I suggest googling around for more general AppleScript help. "theFile" is an alias and there are several ways to extract path information from it, including the containing folder and file name.

Re: Sending an iMessage through Messages upon file download.

PostPosted: Sun Nov 25, 2012 5:02 pm
by bondjw07
Any chance you can post the script you are using to send the message via iMessage? I'd love to do the same thing! I also might be able to help you change it to make it work.

Re: Sending an iMessage through Messages upon file download.

PostPosted: Mon Nov 26, 2012 2:18 pm
by randallpjenkins
Sure, obviously using placeholders for the iMessage accounts email address, you can also send to a phone number:
Code: Select all
tell application "Messages"
   set theBuddy to buddy "your@imessage.account" of service "E:sender@imessage.account"
   send "There is a new episode of Workaholics available to watch on the Media Server." to theBuddy
   quit
end tell