Select Items in Custom View with Applescript

K

Ken Hilburn

I have been trying to sort through a large volume of email within
Entourage with Applescript and, as you guys know, it's very slow and
Entourage does not support multithreading when it comes to Applescript
(so Entourage waits for the mass processing to complete).

An alternative that would work better is to have the Applescript
automagically select the results of a custom view (representing the
most recent of emails in multiple folders) and then complete the
actions that I want to perform on them.

I know that Entourage (I'm using 2004) does not support this, but does
anyone know of a solution to this?

Thanks in advance!

Ken
 
P

Paul Berkowitz

I have been trying to sort through a large volume of email within
Entourage with Applescript and, as you guys know, it's very slow and
Entourage does not support multithreading when it comes to Applescript
(so Entourage waits for the mass processing to complete).

An alternative that would work better is to have the Applescript
automagically select the results of a custom view (representing the
most recent of emails in multiple folders) and then complete the
actions that I want to perform on them.

I know that Entourage (I'm using 2004) does not support this, but does
anyone know of a solution to this?

Actually, you can do it. Open the custom view, select all, then

set hugeList to the selection


and that will give you all the items. Remember that 'whose' clauses do not
work on AppleScript lists like the above - only on application references
which we're not using here. So you have to do everything by repeat loop.

***One piece of lore you may not know is that iterating through large lists,
is MUCH faster (possibly hundreds of times faster!) if you use 'my' when
doing so:


repeat with i from 1 to (count hugeList)
set theItem to item i of my hugeList

You can only use 'my' if this hugeList has global scope - that is, this part
of script is at the top-level (not in a subroutine) or you declare it as a
global or property: then it's OK in a subroutine too. Otherwise, to get the
equivalent speed, you need to use a script object in a subroutine - ask me
how if you're interested.

P.S. It would even be possible to open the custom view by script and select
all by GUI scripting - probably - if you wanted to automate the whole thing.
Ask that too if interested.


--
Paul Berkowitz
MVP MacOffice
Entourage FAQ Page: <http://www.entourage.mvps.org/faq/index.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 Microsoft Office you are using -
**2004**, X or 2001. It's often impossible to answer your questions
otherwise.
 
K

Ken Hilburn

Paul,

Thanks for the info. It is helpful. However, I WOULD like to know
how to automate the entire list. I'm trying to set up an automatic
schedule to selectively remove certain emails from the server based on
properties of those emails. If I try to iterate through the whole
Entourage email database (about 7000 emails), it takes about 50
minutes ( need to try your other suggestion below to see if that makes
the iteration quicker), but if I could use a custom view to do th
initial selection, the total number of emails is reduced to a couple
of hundred or less (which processes very quickly). If I could
automate the process and schedule it with the check mail, that would
be the ticket.

Thanks again.
 
Top