AppleScript the Application of Rules

S

Sam Elowitch

Is it possible to write an AppleScript that will select a folder and apply
an Entourage rule to its contents? I'm stuck....

-Sam
 
P

Paul Berkowitz

Is it possible to write an AppleScript that will select a folder and apply
an Entourage rule to its contents? I'm stuck....

No. Rules aren't scriptable. On the other hand, anything you can do by a
rule (and then some) you can do by AppleScript. What's the rule which you
want to apply?

--
Paul Berkowitz
MVP Entourage
Entourage FAQ Page: <http://www.entourage.mvps.org/toc.html>
AppleScripts for Entourage: <http://macscripter.net/scriptbuilders/>

Please "Reply To Newsgroup" to reply to this message. Emails will be
ignored.

PLEASE always state which version of Entourage you are using - 2001 or X.
It's often impossible to answer your questions otherwise.
 
P

Pierre Froelicher

Dear Paul
Could you please look at my message "appointments are invisibel".
I am desperate for a solution

Thank you
Pierre Froelicher
 
S

Sam Elowitch

Well, Paul, here's the situation:

I subscribe to a number of online forums such as forums.macnn.com and
others, and each e-mail address associated with the forums is part of a
group I call Subscribed Forums. I have a rule that deletes all messages from
that group that are once their status changes to "read". However, I have to
apply the rule manually and would prefer to do it automatically.

-Sam
 
P

Paul Berkowitz

You can't do it instantaneously, the moment each message is read. But you
could make a schedule to run regularly to run a script which does the same
thing. You could run it every hour, every 10 minutes, whatever. It would
take me a long time to set it up so you could apply it to a group of a
different name, of your choice, and MUCH longer to let you choose which
folder(s) to apply it to from a display of all folders. So here I'm assuming
that the messages are in your local Inbox . If they're in a different folder
or folders, let me know which - and if they're subfolders and/or IMAP
folders, let me know all teh details - names of the folders and parent
folders and/or account. Here it is for the Inbox:


tell application "Microsoft Entourage"
set theFolder to folder "Inbox"
set allGroupMembers to (content of every group entry of group
"Subscribed Forums")
delete (every message of theFolder whose sender is in allGroupMembers
and read status is read)
end tell



It could quite easily be arranged to run on more than one folder, but it
involves a few extra lines. Let me know the names of the folders, and parent
folder names if they're subfolders.


--
Paul Berkowitz
MVP Entourage
Entourage FAQ Page: <http://www.entourage.mvps.org/toc.html>
AppleScripts for Entourage: <http://macscripter.net/scriptbuilders/>

Please "Reply To Newsgroup" to reply to this message. Emails will be
ignored.

PLEASE always state which version of Entourage you are using - 2001 or X.
It's often impossible to answer your questions otherwise.
 
S

Sam Elowitch

Paul,

Here¹s what I tried (it¹s very similar to what you proffered):

tell application "Microsoft Entourage"
set theFolder to folder "Personal" of folder "Inbox"
set allGroupMembers to (content of every group entry of group
"Subscribed Forums")
delete (every message of theFolder whose sender is in allGroupMembers
and read status is read)
end tell

For some reason, it doesn't seem to work.
Also, how come the second-to-last command does not read "and WHOSE read
status is read"?

-Sam
 
P

Paul Berkowitz

Paul,

Here¹s what I tried (it¹s very similar to what you proffered):

tell application "Microsoft Entourage"
set theFolder to folder "Personal" of folder "Inbox"
set allGroupMembers to (content of every group entry of group
"Subscribed Forums")
delete (every message of theFolder whose sender is in allGroupMembers
and read status is read)
end tell

For some reason, it doesn't seem to work.
Also, how come the second-to-last command does not read "and WHOSE read
status is read"?

Because it's not English, it's AppleScript. How come it doesn't say "AND
THEN go to sleep" or "THEN have a beer"? For the same reason.

I don't know why it's not working for you. It may be because a certain
item-to-list coercion isn't working. You can do the same thing by a slower
process:

tell application "Microsoft Entourage"
set theFolder to folder "Personal" of folder "Inbox"
set allGroupMembers to (content of every group entry of group
"Subscribed Forums")
set allMsgs to (every message of theFolder)
repeat with i from 1 to (count allMsgs)
set theMsg to item i of allMsgs
if {sender of theMsg} is in allGroupMembers and read status of
theMsg is read then
delete theMsg
end if
end repeat
end tell


--
Paul Berkowitz
MVP Entourage
Entourage FAQ Page: <http://www.entourage.mvps.org/toc.html>
AppleScripts for Entourage: <http://macscripter.net/scriptbuilders/>

Please "Reply To Newsgroup" to reply to this message. Emails will be
ignored.

PLEASE always state which version of Entourage you are using - 2001 or X.
It's often impossible to answer your questions otherwise.
 
S

Sam Elowitch

Because it's not English, it's AppleScript. How come it doesn't say "AND
THEN go to sleep" or "THEN have a beer"? For the same reason.

LOL. Well said! I had momentarily forgotten that we're dealing with AS
syntax here.
I don't know why it's not working for you. It may be because a certain
item-to-list coercion isn't working. You can do the same thing by a slower
process:

tell application "Microsoft Entourage"
set theFolder to folder "Personal" of folder "Inbox"
set allGroupMembers to (content of every group entry of group
"Subscribed Forums")
set allMsgs to (every message of theFolder)
repeat with i from 1 to (count allMsgs)
set theMsg to item i of allMsgs
if {sender of theMsg} is in allGroupMembers and read status of
theMsg is read then
delete theMsg
end if
end repeat
end tell

Thanks. I'll try it.

-Sam
 
S

Sam Elowitch

Paul,

As you suspected, the shorter of the two AppleScripts you posted worked
after I tweaked the relevant group.

Thank you so much. Truly an awesome timesaver! You da man.

-Sam
 
S

Sam Elowitch

The funny thing about AppleScript, I find, is that while reading an existing
script makes one thing that AS is extremely logical and fair easy to follow,
this is not always the case when trying to build a script from scratch.

The syntax is often deceptively difficult in part because its "English-like"
feel can beguile you into thinking it is easy, which it's not.

-Sam
 
B

Barry N. Wainwright

The syntax is often deceptively difficult in part because its "English-like"
feel can beguile you into thinking it is easy, which it's not.

A very common misconception!

--
Barry Wainwright
Microsoft MVP (see http://mvp.support.microsoft.com for details)
Seen the Entourage FAQ pages? - Check them out:
<http://www.entourage.mvps.org/toc.html>

Please post responses to this newsgroup. If I ask you to contact me
off-list, remove '.INVALID' from email address before replying.
 
P

Paul Berkowitz

The funny thing about AppleScript, I find, is that while reading an existing
script makes one thing that AS is extremely logical and fair easy to follow,
this is not always the case when trying to build a script from scratch.

The syntax is often deceptively difficult in part because its "English-like"
feel can beguile you into thinking it is easy, which it's not.

Exactly right.

--
Paul Berkowitz
MVP Entourage
Entourage FAQ Page: <http://www.entourage.mvps.org/toc.html>
AppleScripts for Entourage: <http://macscripter.net/scriptbuilders/>

Please "Reply To Newsgroup" to reply to this message. Emails will be
ignored.

PLEASE always state which version of Entourage you are using - 2001 or X.
It's often impossible to answer your questions otherwise.
 
Top