Re: Existing Entourage Message
Re: Existing Entourage Message
- Subject: Re: Existing Entourage Message
- From: Jamie Jordan <email@hidden>
- Date: Sun, 16 Sep 2001 18:05:49 -0400
Here9s the final script. It may not be the best but it works. You can
select a message that you have received, reply to it which opens a 3draft2
message, then you pick the script below from the Entourage Script menu. It
attaches 2 documents and then inserts text in the body of the message. Many
thanks to Jolly Roger and to Paul Berkowitz.
I do have a question however about the variables. If you put the line
set theFile to alias {startupDiskName & ":Desktop Folder:Email Scripts:Agent
Cover Note Text"}
Inside the tell application 3Finder2 section it says 3theFile2 is not
defined. How come?
Script starts here:
set startupDiskName to ""
set theAttachments to {""}
set theFile to ""
tell application "Finder"
set startupDiskName to name of startup disk
set theAttachments to {startupDiskName & ":Desktop Folder:Email
Scripts:emInvoice.doc", startupDiskName & ":Desktop Folder:Email
Scripts:emCHStudAppAttch.doc"}
end tell
set theFile to alias {startupDiskName & ":Desktop Folder:Email Scripts:Agent
Cover Note Text"}
tell application "Microsoft Entourage"
activate
if class of window 1 is draft window then
set theMsg to window 1
end if
repeat with i from 1 to (count theAttachments)
set theAttachment to item i of theAttachments
make new attachment at theMsg with properties {file:theAttachment}
end repeat
end tell
insertFile(theFile)
on open (fileList)
repeat with theFile in fileList
insertFile(theFile)
end repeat
end open
on insertFile(theFile)
try
set fileRef to open for access theFile
set textToInsert to read fileRef
on error errString
display dialog "There was an error reading the file because:" &
errString ,
buttons {"OK"}
return
end try
try
end try
try
tell application "Microsoft Entourage"
set selection to textToInsert
end tell
on error errString
display dialog "This script can only insert into the body of a
message" buttons {"OK"}
return
end try
end insertFile
Jamie Jordan
Founder & Developer
--
macs@work
Helping People Who Choose Macintosh
@work, @home, @school, @play
http://www.macs-at-work.com