Re: displaying url messages in the Body field of Eudora
Re: displaying url messages in the Body field of Eudora
- Subject: Re: displaying url messages in the Body field of Eudora
- From: Sander Tekelenburg <email@hidden>
- Date: Tue, 14 Sep 2004 01:54:33 +0200
At 15:50 -0700 UTC, on 2004/09/13, Tim wrote:
[...]
> here is the code below. I can't even get a simple text message to
> appear in body of the message - although the code below also includes
> a finder hack that takes just the 'filename' and appends it to the
> root path for the http server.
>
> so basically what I want to do is get the filename for each dropped
> file and then append it to the root http path and then insert it in
> the body of the message.
I don't understand what the attach to command is doing in your script. What
are you trying to attach?
[...]
> code ========
>
>
> tell application "Eudora" to tell (make message at end of mailbox
>"out")
> attach to documents listofFiles
> set field "subject" to ("Subject")
> set field "from" to ("email@hidden")
> repeat with i in listofFiles
> tell application "Finder"
> set filename to name of i
> set nameList to {filename}
> end tell
> end repeat
>
> set the bodyText to "file can also be downloaded
> here:<br>http://www.mydomain.com/dirforfiles/" & nameList
> set bodyText to body of front message
>
> end tell
[1] In some of your code you forgot to tell Eudora *which* message you want
to edit. The proper syntax goes:
set field x of message y of mailbox z to abc
[2] Make sure to use references when creating and editing something. That's
the only way to be sure that you are always targeting the object you want to
target. (For instance, if while the script is running some other message
comes to the front in Eudora, the last line of your code would risk targeting
that...)
[3] I'm not sure what you're trying to achieve with that Finder code.
[3A] You appear to want to generate a list, but you're only storing the last
value of the repeat loop
The way to generate a list is to first define it, then have each repeat *add*
something to that list. For instance:
set nameList to {}
repeat with i in listofFiles
tell application "Finder"
set filename to name of i
set nameList to nameList & filename
end tell
end repeat
[3B] However, what is the point of grabbing the file's names? Eudora's
dictionary says it wants a list of aliasses, not file names.
I think what you want is something more like this below. (Note that I have
the script enclose the URL in angle brackets, as it should, and omit any HTML
as that doesn't belong in email.)
tell application "Eudora"
try
set the_message to (make new message at end of mailbox "Out")
set field "subject" of the_message to "Subject"
set field "from" of the_message to "email@hidden"
repeat with i in listofFiles
tell application "Finder"
set filename to name of i
set bodyText to "file can also be downloaded at
<http://www.mydomain.com/dirforfiles/" & filename & ">"
-- will fail if the variable nameList is undefined
end tell
set body of the_message to bodyText
end repeat
on error m number n
log {n, m}
end try
end tell
--
Sander Tekelenburg, <http://www.euronet.nl/~tekelenb/>
_______________________________________________
Do not post admin requests to the list. They will be ignored.
Applescript-users mailing list (email@hidden)
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden