Mar 24, '04 10:28:00AM • Contributed by: multiplex
It takes an email address, and a subject line and composes messages with subjects "blablabla (x/X)" where X is the total number of files. Maybe this is useful to someone else. I know I looked high and low for this.
Read the rest of the hint for the script...
tell application "Finder"
if selection is not {} then
set itemList to selection
set itemNumber to count of itemList
else
display dialog "No files selected." buttons {"Cancel"} ¬
default button 1 giving up after 15 with icon 2
end if
end tell
tell application "Mail"
set addrVar to text returned of (display dialog ¬
"Enter destination address:" default answer "hello@parents.org")
set subjectvar to text returned of (display dialog ¬
"Enter subject line:" default answer "Pictures")
display dialog "Number of files: " & itemNumber
repeat with i from 1 to count items in itemList
tell application "Finder"
set the target_file to (document file ¬
((contents of item i of itemList) as string)) as alias
set bodyvar to the name of target_file
end tell
set composeMessage to (make new outgoing message)
tell composeMessage
make new recipient at beginning of to recipients ¬
with properties {address:addrVar}
set the subject to subjectvar & " (" & (i as string) & ¬
"/" & itemNumber & ")"
set the content to bodyvar
tell content
make new attachment with properties {file name:target_file} ¬
at after the last word of the last paragraph
end tell
end tell
send composeMessage
end repeat
end tell
[robg adds: I sent the submitted code to an experienced AppleScripting friend of mine, and he made a few minor changes to make this script work a bit better. He also adds that if you find the dialog box with the item count to be superfluous, it can be safely commented out.]
