Applescripts for Rules

I

ianfore

When you create a rule in Entourage one option is to set an
Applescript that will be run when the rule is activated.

Let's say I have a rule triggered by the arrival of messages that meet
particular criteria. How, in the Applescript that then runs, can I
refer to the message that triggered the rule. I want to be able to
access properties of that message. For example I would want to be able
to do something like

tell application "Microsoft Entourage"
set theSubject to subject of theTriggeringMessage
--- do the stuff I want to here
....
end tell

i.e. how do I refer to theTriggeringMessage?

I searched the obvious places for documentation or examples on this
but didn't find it anything.

Thanks
Ian
 
D

Diane Ross

Let's say I have a rule triggered by the arrival of messages that meet
particular criteria. How, in the Applescript that then runs, can I
refer to the message that triggered the rule. I want to be able to
access properties of that message. For example I would want to be able
to do something like

tell application "Microsoft Entourage"
set theSubject to subject of theTriggeringMessage
--- do the stuff I want to here
....
end tell

i.e. how do I refer to theTriggeringMessage?
The rule itself is where these triggering settings are selected. The
AppleScript runs the action you want to take place only when the rule
criteria are met.

Subject contains xxx

I use AppleScripts to play a sound for notification when I receive mail in
category "friends", "family", "buddy" etc.

Using Rules with Entourage

<http://www.entourage.mvps.org/rules/index.html>

Hope this is clear.
 
I

ianfore

Thanks Diane,

Yes that's clear and I understand how that would work - but I actually
need to be able to refer to the message in the AppleScript.   

This would be a better example of what I want to do.

tell application "Microsoft Entourage"
set messageSize to data size theTriggeringMessage
-- then I would do some calculation with the message size
end tell

In your example, if you wanted to play a different sound according to
the category of the sender you would have a rule and a corresponding
AppleScript for each category. If Entourage does what I am looking for
you could do it with just one rule and AppleScript.

If Entourage allows it I imagine it would probably be similar to how
folder actions work in the Finder.

If I add something to a folder in the Finder my script can refer to
the file that was added like this

on adding folder items to this_folder after receiving added_items
try
tell application "Finder"
--get the name of the folder
set the folder_name to the name of this_folder
end tell

-- find out how many new items have been placed in the folder
set the item_count to the number of items in the added_items
end try
end adding folder items to

Thanks
Ian
 
D

Diane Ross

Yes that's clear and I understand how that would work - but I actually
need to be able to refer to the message in the AppleScript.   

This would be a better example of what I want to do.

tell application "Microsoft Entourage"
set messageSize to data size theTriggeringMessage
-- then I would do some calculation with the message size
end tell



I don't think this is possible, but I'm only a novice scripter. In plain
English, what are you trying to accomplish. I might be able to help find
another way to accomplish your task.

You could try asking on the YouTalk list or the AppleScript users list. We
seemed to have lost some of our AppleScript gurus lately.

"Help and discussions for scripters developing scripts and solutions
in AppleScript." <applescript-users.lists.apple.com>

List-Subscribe: <http://lists.apple.com/mailman/listinfo/applescript-users>,
<mailto:[email protected]?subject=subscribe>

"YouTalk mailing list for discussion of Microsoft Entourage"

List-Subscribe: <http://nine.pairlist.net/mailman/listinfo/youtalk>,
<mailto:[email protected]?subject=subscribe>
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top