Re: Select Items in Custom View with Applescript

From: Paul Berkowitz (berkowit_at_spoof_silcom.com)
Date: 11/24/04


Date: Wed, 24 Nov 2004 09:03:30 -0800

On 11/23/04 11:50 AM, in article
f4c0d040.0411231150.4f11030f@posting.google.com, "Ken Hilburn"
<khilburn@gmail.com> wrote:

> 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.


Relevant Pages

  • Re: Word 2004 VBA -> Applescript
    ... That sounds like a reason in itself for trying out AppleScript Studio. ... the main script file and call out to "action" handlers in another script ... subroutines, from tiny to small (my find & replace subroutine is the largest ... The truth is, despite the difficulty of working with VBA on the Mac, I ...
    (microsoft.public.mac.office.word)
  • Re: Exporting list of projects?
    ... >> Script in the Entourage Script Menu Items folder to run whenever you want. ... but we can't do that since projects - in AppleScript - don't have tasks, ... doing a very tedious repeat loop through all objects in Entourage. ...
    (microsoft.public.mac.office.entourage)
  • Re: Auto loading applescripts?
    ... That's the biggest lack of AppleScript compared to VBA ... there is currently no mechanism of any type to embed a script inside a ... as there is in Entourage. ... Office macros enabled a whole plethora of viruses, ...
    (microsoft.public.mac.office.word)
  • Re: AppleScript question (slightly OT)
    ... >> If I run the script from the script editor it works, ... >> it from the AppleScript menu in Entourage. ... And the value in that preference key will be returned. ...
    (microsoft.public.mac.office.entourage)
  • Re: Searching for AppleScript references or object model
    ... AppleScript wanting to appear "user friendly", ... > sort of event handling provided by the Entourage object model. ... There are almost _no_ applications which have event handling in AppleScript ... I know only of a couple script editors which are attachable. ...
    (microsoft.public.mac.office.entourage)

Loading