Script Suddenly Failing

S

Sam L Elowitch

I had thought that this script, which I trigger on a schedule, was working
fine:

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

Unfortunately, it seems to only deleted a selected message whose read status
is read and which is a member of the group "Subscribed Forums". Odd.

I've tried checking and double-checking the display names and e-mail
addresses and I'm certain they're correct.

What could be wrong with this script?

-Sam
 
P

Paul Berkowitz

I had thought that this script, which I trigger on a schedule, was working
fine:

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

Unfortunately, it seems to only deleted a selected message whose read status
is read and which is a member of the group "Subscribed Forums". Odd.

I've tried checking and double-checking the display names and e-mail
addresses and I'm certain they're correct.

What could be wrong with this script?

It works just fine here. You're saying that unless you happen to have that
"Personal" folder open with a particular message meeting the criteria
selected (highlighted) in the UI nothing happens when you run the script?

Selection is irrelevant here. There's no mention of selection or 'current
messages' in the script. 'move' - if it's working at all (i.e. the folder
must be local, not IMAP or Hotmail) should be working on the whole set of
messages meeting the criteria. And the 'whose' clause is structured
correctly (normally 'is in' requires list brackets around {sender} but not
in a whose clause). So - IF the display names are really EXACTLY the same in
both email message and contact name/group entry, then it should work. It
does here.

Personally, I think you should avoid all possibility of the sender using a
slightly different display name by instead using this version:

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 in theFolder where address of its sender is in
allGroupMembers and read status is read)
end tell

This way you just check addresses, not display names, and 'delete' is
better-behaved than 'move'.

However, I notice that the name of your group is "Subscribed Forums". If
this includes (or means) mailing lists, you should be aware that messages
from mailing lists are actually TO the mailing list, not FROM it. The
mailing list is not the message's sender - the original sender is. So if you
want to delete mailing list messages you'd have to fit in another criterion.
In fact you'd couldn't do it by simple whose clause, you'd have to do it by
repeat loop, checking each item of (address of every recipient) against the
same list of allGroupMembers or list of (list address of every mailing
list) if they're registered mailing lists in the MLM, which might be
quicker.


--
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 L Elowitch

Thanks for the interesting, detailed, and thought-provoking response, Paul.
As usual, you amaze me. I'll report back what happens.

-Sam
 
P

Paul Berkowitz

Except I copied, pasted and edited pasted "my version" incorrectly. Sorry.
That screwed it all up. It needs 'address of...' for allGroupMembers. It
should read:



tell application "Microsoft Entourage"
set theFolder to folder "Personal" of folder "Inbox"
set allGroupMembers to (address of content of every group entry of group
"Subscribed Forums")
delete (every message in theFolder where address of its sender is in
allGroupMembers and read status is read)
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.
 
Top