Hi
I have the following script that lets you drag and drop a file, creates an email with the attachment, lists the names of the attachments in the message body and sends it. It works fine, however, I want to set the subject of the file to the name of the attachment (there will never be more than one attachment). Does anyone have any idea how I can do thos?
thanks!!
property default_address : “whoever@whatever.com”
property mail_subject : “what is the subject of your email”
on open the_files
repeat with eachFile in the_files
end repeat
tell me to activate
if mail_subject is "what is the subject of your email" then
display dialog "Enter the subject:" default answer mail_subject
set the mail_subject to text returned of the result
end if
set the compression_setting to "Yes"
tell application "Microsoft Entourage"
activate
set MyMessage to make new draft window with properties ¬
{recipient:default_address, subject:mail_subject, content:my_content, attachment:the_files, encoding:AppleDouble, compression type:stuffit compression}
if class of window 1 is draft news window or class of window 1 is draft window then
tell window 1
try
set theNames to name of every attachment
on error
return -99 -- silent exit
end try
if (count theNames) > 1 then
set messageText to return & ""
repeat with aName in theNames
set messageText to messageText & return & tab & aName
end repeat
set messageText to messageText & return & return
else if (count theNames) = 1 then
set messageText to return & theNames & return & return
end if
set selection to messageText
end tell
end if
send MyMessage
end tell
tell application "Finder"
activate
end tell
end open :shock: