Title: Re: Question for the script wizards ;)
Thanks again to Mr. Tea and Allen for helping with this (from a week or two ago). Unfortunately, I'm not having much luck with the script. I'm using Entourage 2001, not X.

Allen's adaptation of Mr. Tea's script:

on 5/7/02 3:15 PM, Allen Watson at [EMAIL PROTECTED] wrote:
> tell application "Microsoft Entourage"
>   activate
>   display dialog "Enter a name to go before the '@' symbol:" default answer ""
>   set theName to the text returned of the result
>   if theName is not "" then
>       set theAddress to email address of POP account "Generic"
>       set n to offset of "@" in theAddress
>       set theDomain to text n thru (count of text items in theAddress) of
> theAddress
>       set email address of POP account "Generic" to theName & theDomain
> set theMsg to item 1 of (get current messages)
> set the account of theMsg to POP account "Generic"
>   end if
> end tell


My modified version to work with an account called "MISC"

tell application "Microsoft Entourage"
    activate
    display dialog "Enter a name to go before the '@' symbol:" default answer ""
    set theName to the text returned of the result
    if theName is not "" then
        set theAddress to email address of POP account "MISC"
        set n to offset of "@" in theAddress
        set theDomain to text n thru (count of text items in theAddress) of theAddress
        set email address of POP account "MISC" to theName & theDomain
        set theMsg to item 1 of (get current messages)
        set the account of theMsg to POP account "MISC"
    end if
end tell


If I run the script on a new message that hasn't been saved, I get the prompt asking me what I want before the @ symbol; when I enter it, and hit return, I get the following error:

    Can't get item 1 of {}

When I run the script on a message that has been saved first, I get the prompt asking me what I want before the @ symbol; when I enter it, and hit return, it changes the return address in the MISC account (I checked) but it doesn't change the account in the current message.

Did I miss something obvious? ;)


P.S. If I wanted to alter the script so that it asks me for the entire address I want to be used as the return address, would the following script be correct?

tell application "Microsoft Entourage"
    activate
    display dialog "Enter a name to go before the '@' symbol:" default answer ""
    set theAddress to the text returned of the result
    if theAddress is not "" then
        set email address of POP account "MISC" to theAddress
        set theMsg to item 1 of (get current messages)
        set the account of theMsg to POP account "MISC"
    end if
end tell

Reply via email to