applescript via blackberry

so the goal of my script is to be able to create a script remotely via blackberry. I want to be able to send an email from my blackberry which will set off a rule that will open an applescript that will take the text from the email and run it in the applescript editor.

here is what i have so far.

tell application "Mail"
	set theMessage to message 1 of mailbox "INBOX" of account "AOL"
	set theContent to the content of theMessage
	tell application "AppleScript Editor"
		make new document with data theContent
	end tell
end tell

the script here will copy the message i’ve sent from my phone to a new document in applescript editor, but it always includes "“Sent via BlackBerry from T-Mobile”.

so the question is how to exclude that part of the text when copying it to a new document.


seems like a textoperation …

set themessage to "Sent via BlackBerry from T-Mobile
lknklnklnl klnälknäkläkl klnälnälkn 
#ölmäm älälknäkl älknäklnä lkn
Sent via BlackBerry from T-Mobile
 lknlknlälnälknälnälkn klnäln äklnälnäl 
löm mämä mämölm m
Sent via BlackBerry from T-Mobile"
set {TID, text item delimiters} to {text item delimiters, "Sent via BlackBerry from T-Mobile"}
set themessage to (every text item of themessage)
set AppleScript's text item delimiters to ""
set themessage to themessage as text
set AppleScript's text item delimiters to TID

i don’t know much about applescript, but this definitely sent me in the right direction. THANKSS!! :slight_smile:

fine. You should have a look at the sample-rule-action-script for mail in the library … :wink:

Well it is very dangerous to eval code from an incoming mail. For all other readers: never do this unless you are aware of the security lacks you create. Mac OS X provides dozens of ways to run a script remotely so don’t do this by eval code that comes from a mail.