Title: Re: Scripting The From Account
On 8/10/02 23:45, Thomas Chaffee wrote:
> Okay you scripting whizzes - this is probably impossible, but it never hurts
> to ask. I have two different POP accounts on evX which I use for two
> different companies for which I work.
>
> Is it possible to have an outbound email address trigger which account is
> used? For instance I want to use my "domain1.com" account to send to any
> address that uses "@domain1.com" and the "domain2.com" account to send to
> any address that uses "@domain2.com".
Do you want this for all messages (including Replies, Forwards, etc), or just for new messages?
If for all messages, I believe Paul B. has a script that does something similar (it works by periodically checking, I think, messages in progress and messages in the out box folder, and then changes the sending account for those that meet the criteria you've specified).
If you just want it for new messages, then you could create a couple of AppleScripts that simply make a new message window that uses the specified account. For example:
tell application "Microsoft Entourage"
make new draft window with properties{account:POP account "accountnamehere"}
end tell
You’d put the actual name of the account where I have “accountnamehere”, of course, and you do put the quotation marks around the name.
I’m also assuming these are POP accounts. If they’re IMAP accounts, then use the word ‘IMAP’ (without any quotes) in place of the word ‘POP’.
Save the compiled scripts into your scripts folder.
TIP FOR NEW SCRIPTERS
When using things like accounts, signatures, folders, whatever, just about everyone uses the name of the item in question when writing a script. That’s convenient and easy because you can see the name. But, if for any reason you ever change the name of the account/signature/folder/whatever, you’d need to edit the script to account for the change.
So I strongly encourage you to use ID numbers whenever possible. To get the ID number of any given item, just run a script that does something like:
tell application “Microsoft Entourage”
ID of POP account “domain2.com”
end tell
The ID will be displayed in the Results window of Script Editor (we’ll assume it’s 2). Now you can make use of that in your ‘real’ script:
tell application “Microsoft Entourage”
make new draft window with properties{account:POP account ID 2}
end tell
If you need the name for some other purpose, you can get it with:
name of POP account ID 2
Folders may require a little more work.
Of course, Entourage’s main folders all have pre-defined equivalents: in box folder, out box folder, etc (see the ‘application’ class in the AS Dictionary). You should always use those instead of ID numbers or names.
For other folders, if they’re at the top level you can use the syntax noted above. If they’re nested, though, then you need to use:
ID of folder “inside folder” of folder “outside folder” -- etc, until you reach the top folder
Once you have that ID number, though, you can move or rename the folder, and Entourage won’t care, because it’s locating the folder by ID number.
It’s an extra (small) step while developing your script, but it allows you to change names of these things without having to go back and change your scripts.
Obviously if you delete any item used in a script, whether you refer to it by name or by ID number, the script will error, but that’s another story.
George
--
George Clark - [EMAIL PROTECTED]
- Scripting The From Account Thomas Chaffee
- Re: Scripting The From Account George Clark
- Re: Scripting The From Account Paul Berkowitz
- Re: Scripting The From Account George Clark
- Re: Scripting The From Account Paul Berkowitz
