On 20/5/02 7:47 pm, "Dan Frakes"  wrote:

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

Here's the problem:
>       set n to offset of "@" in theAddress
>       set theDomain to text n thru (count of text items in theAddress) of
> theAddress

You need to decide which way you are doing it - you ask for the offset, then
don't use it. However, you do ask for text items without setting the text
item delimiters!

Try substituting this code:

Set AppleScript's text item delimiters to {"@"}
Set  theDomain to item 2 of text items of theAddress

>       set email address of POP account "MISC" to theName & theDomain
Set email address of POP account "Misc" to {thename, theDomain} as text

>       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? ;)
> 
Yes :)

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

Apart from the prompt for the dialog being a little misleading, that should
work OK

-- 
Barry Wainwright
<http://www.barryw.net>


"If you tell the truth, you don't have to remember anything." - Mark Twain



-- 
To unsubscribe:                     
<mailto:[EMAIL PROTECTED]>
archives:       
<http://www.mail-archive.com/entourage-talk%40lists.letterrip.com/>
old-archive:       
<http://www.mail-archive.com/entourage-talk%40lists.boingo.com/>

Reply via email to