Title: Re: More on new mail messages to specific accounts
On 12/19/02 8:03 AM, "George Clark" <[EMAIL PROTECTED]> wrote:

on addtolist(more)
    if more is not {} then
       if acctlist is {} then
           set acclist to more
       else
           set acctlist to acctlist & more
       end if
   end if
end
addtolist

No actual need for the exclusion of more = {}, of course, and it's better scripting technique to return acctlist from the handler instead of using a global. So in fact you don't need the handler or the ifs at all, simply

    set acctlist to (poplist & imaplist & hotlist)

You also set choice to item 1 of choice, so it's now a string, and then search for it in a list, when you must have the same class on either side of 'is in' or contains. Fortunately AppleScript will coerce a string to a single-item list, but you're just asking for trouble if you forget about 'same class on both sides' rule as soon as you need to choose things other than strings in lists - for example, Entourage accounts, or categories, or contacts.

So, shorter and neater:


tell application "Microsoft Entourage"
    set poplist to {}
    try
       set poplist to name of every POP account
    end try
   set imaplist to {}
    try
       set imaplist to name of every IMAP account
   end try
   set hotlist to {}
    try
       set hotlist to name of every Hotmail account
   end try
   
set acctlist to (poplist & imaplist & hotlist)
end tell

set choice to choose from list acctlist with prompt "Select sending account"

if choice is not false then
   tell application "Microsoft Entourage"
        set choice to item 1 of choice
       if {choice} is in poplist then
           set acct to POP account choice
       else if {choice} is in imaplist then
           set acct to IMAP account choice
       else
           set acct to Hotmail account choice
       end if
       make new draft window with properties {account:acct}
    end tell
end
if



--
Paul Berkowitz
MVP Entourage


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

Reply via email to