On 2/9/01 6:38 AM, "G Wood" <[EMAIL PROTECTED]> wrote:
> The script works fine, even though I get an error dialog.
>
> Here is the script snip:
>
> ...
> set theMsgWin to front window
> set account of theMsgWin to replyAcct
> ...
>
>
> Here is the error:
>
> [Can't make <<class popA>> id33 of application "Microsoft Entourage" into a
> string.]
>
> The acct DOES change, and the setup DOES work. (When I invoke the script for
> first run, it "takes" the new acct; after the first run, the acct pop-up is
> properly switched when script is run.)
>
> So: what's the error? And: why does it work anyway? And: how can make it
> go away?
>
Gary,
You're giving us two lines of the script, but not what you're feeding into
the variable 'replyAcct'. It sounds as if you may be trying to do this:
set replyAcct to "Some Name"
set theMsgWin to front window
set account of theMsgWin to replyAcct
whereas what the applescript syntax requires is:
set replyAcct to POP account "Some Name"
set theMsgWin to front window
set account of theMsgWin to replyAcct
What AppleScript really does, and needs, is this:
set replyAcct to POP account id 33
That is defining the variable as an object of POP account class, which lets
you set the account of a draft window to that variable two lines later. If
you look in the Entourage Dictionary under 'application', meaning Entourage
itself, you'll see the various elements of the application (like almost any
element) defined , for example, like this:
window -- by numeric index, name, relative position, test
POP account -- by numeric index, test
Actually, this appears to be an error, since you can refer to a POP account
by name or relative position as well as by numeric index and test. (Dan?)
But Script Editor's Event Log and Result Window, or Smile's Output Windows,
will show that the other versions are always "translated" back to 'numeric
index', id number. If you write
POP account "Some Name" -- by name
you'll see the result as
-- POP account id 33
Similarly
POP account 17 -- by relative position
-- POP account id 33
and the wonderful implementation of "whose clauses" in Entourage:
first POP account whose name starts with "Some" -- by test
-- POP account id 33
or even
first POP account whose email address contains "domain" -- by test
-- POP account id 33
But if you just try
"Some Name"
-- "Some Name"
or
"[EMAIL PROTECTED]"
-- "[EMAIL PROTECTED]"
you'll just get the the string repeated back to you because that's all it
is, even if it's in an Entourage tell block.
So if you write:
tell application "Microsoft Entourage"
set replyAcct to "Some Name"
set theMsgWin to front window
set account of theMsgWin to replyAcct
end tell
you'll get an error. Now when I do that, I actually get a different error
-- ERROR: "Microsoft Entourage expected a reference
and it doesn't change, so maybe you're doing something different. Or
AppleScript 1.1.2 (OS 8.1) may give a different error than As 1.5.5 (OS
9.1).
But when I make the first line the equivalent of
set replyAcct to POP account "Some Name"
using a real account name, it does work without any errors. So that's why I
suspect you're defining the variable representing the account incorrectly,
even though I can't get the same error with my system. With more
information, I could probably figure this out for you.
HTH.
--
Paul Berkowitz
--
To unsubscribe: <mailto:[EMAIL PROTECTED]>
To search the archives:
<http://www.mail-archive.com/entourage-talk%40lists.boingo.com/>