Rev & Applescript
Marty Knapp
martyknapp at comcast.net
Tue May 3 14:57:50 EDT 2005
>> I'm trying to get Rev to do an Applescript that will talk to either Mail or
>> Entourage (Mac) to auto-generate an email, attach several pdf files and then
>> send the email (with no interaction on my part). The email will always go
>> the the same recipient, but the content will change, so I need to be able to
>> generate that on the fly.
I've gotten one script to work (has one file attachment) but the second does
not. I don't know if my repeat loop is not correct or the way I'm delimiting
the file attachments, or both. Each email will have 2 or more attachments.
WORKS:
tell application "Mail"
set theSubject to "Test Order"
set theBody to "TESTING 123"
set theSender to "martyknapp at comcast.net"
set theName to "ADI"
set theAddress to "martyknapp at comcast.net"
set theAttachment to <full path to file>
set newMessage to make new outgoing message with properties
{subject:theSubject, content:theBody & return & return}
tell newMessage
set visible to false
set sender to theSender
make new to recipient at end of to recipients with properties
{name:theName, address:theAddress}
tell content
make new attachment with properties {file name:theAttachment} at
after the last paragraph
end tell
end tell
send newMessage
end tell
DOESN'T WORK:
tell application "Mail"
set theSubject to "BS Order"
set theBody to "TESTING 123"
set theSender to "martyknapp at comcast.net"
set theName to "ADI"
set theAddress to "martyknapp at comcast.net"
set fileList to <path to file 1> & return & <path to file 2>
set newMessage to make new outgoing message with properties
{subject:theSubject, content:theBody & return & return}
tell newMessage
-- Default is false. Determines whether the compose window will
-- show on the screen or whether it will happen in the background.
set visible to true
set sender to theSender
make new to recipient at end of to recipients with properties
{name:theName, address:theAddress}
tell content
repeat with fileName in fileList
make new attachment with properties {file name:fileName} at
after the last paragraph
end repeat
end tell
end tell
send newMessage
end tell
--
Any ideas?
Thanks so much,
Marty Knapp
More information about the use-livecode
mailing list