Become a MacRumors Supporter for $50/year with no ads, ability to filter front page stories, and private forums.

Scaldy

macrumors newbie
Original poster
Nov 1, 2009
2
0
I'm aware that using these rule driven applescripts aren't the greatest of ideas since they could potentially allow someone to activate the rule that wasn't originally intended, but what I want to do isn't very dangerous.

I have some experience using applescripts, but this just seems out of my league.

My goal is to send myself a mail via my phone to my home mac, have that mail trigger a rule which then copies the text in the body of the mail, then appends the copied text to a .txt file, saves it, and closes.

My endgame here is to be able to send myself an email to add an item to my todo list and update it on the fly. I've considered using other services to get this done, but I'm trying to preserve the way I'm doing it on my computer normally while integrating the "on-the-go" updates.

Any help would be appreciated.

::EDIT::

After some more thought, if the applescript could be triggered from receiving an adium message from a specific screen name... that would work too.
 
Smash and Grab

It's a bit ropey but this should do the trick!

Basically you should set a rule that when Mail receives a message with "AddToDo" as a subject line fire up this AppleScript, it adds the body of your message to a given text file.

Should get you started anyway!
--Variables
set ToDoDoc to "Macintosh HD:Users:yourusername: Desktop:ToDoItems.rtf" --Path to your document
set SubjectFlag to "AddToDo" -- unique Subject Line to add to

set ToDoItem to ""

tell application "Mail"
activate
try
tell (first message of inbox whose subject is SubjectFlag) to if exists then
set ToDoItem to first paragraph of (get content) as text
end if
end try
--return ToDoItem
end tell

tell application "TextEdit"
activate

open ToDoDoc
set paragraph 1 of document 1 to ToDoItem & return & paragraph 1 of document 1
save document 1
close document 1
end tell
 
Thanks for the reply, I'll try it out and see how it goes.
 
Register on MacRumors! This sidebar will go away, and you'll see fewer ads.