Adding an attachment via script

  • Thread starter Harinder S. Bawa
  • Start date
H

Harinder S. Bawa

Thanks for your help (Barry). I can't seem to find the correct syntax for
adding the attachment. After plagiarizing many scripts, this is what I came
up with:

set theName to "My Name"
set theAddress to "[email protected]"
set theSubject to "someSubject"
set theAttachment to "/Users/myUsername/Desktop/scratch.rtf "
set theSender to "[email protected]"
set theBody to "Here is some body text."
set theAttachment to theAttachment as text
tell application "Microsoft Entourage"
set newMessage to make new outgoing message with properties
{subject:theSubject, sender:theSender, to recipients:theAddress,
content:theBody & return & return}
make new attachment with properties {name:theAttachment}

activate
end tell



I get the error "Microsoft Entourage got an error: Some data was the wrong
type."

Help please. Thanks.

Harinder
 
P

Paul Berkowitz

Thanks for your help (Barry). I can't seem to find the correct syntax for
adding the attachment. After plagiarizing many scripts, this is what I came
up with:

set theName to "My Name"
set theAddress to "[email protected]"
set theSubject to "someSubject"
--set theAttachment to "/Users/myUsername/Desktop/scratch.rtf "

NO.

set theFile to alias "Macintosh HD:Users:myUsername:Desktop:scratch.rtf"
set theSender to "[email protected]"
set theBody to "Here is some body text."
set theAttachment to theAttachment as text
tell application "Microsoft Entourage"
set newMessage to make new outgoing message with properties
{subject:theSubject, sender:theSender, to recipients:theAddress,
content:theBody & return & return}
--make new attachment with properties {name:theAttachment}

make new attachment at newMessage with properties {file:theFile}
activate
end tell



I get the error "Microsoft Entourage got an error: Some data was the wrong
type."




--
Paul Berkowitz
MVP MacOffice
Entourage FAQ Page: <http://www.entourage.mvps.org/faq/index.html>
AppleScripts for Entourage: <http://macscripter.net/scriptbuilders/>

Please "Reply To Newsgroup" to reply to this message. Emails will be
ignored.

PLEASE always state which version of Microsoft Office you are using -
**2004**, X or 2001. It's often impossible to answer your questions
otherwise.
 
H

Harinder S. Bawa

Cool! Thanks a lot.

Harinder


NO.

set theFile to alias "Macintosh HD:Users:myUsername:Desktop:scratch.rtf"


make new attachment at newMessage with properties {file:theFile}
 
Top