Mail all files in folder or more then one file

Hi all

I am a VBA guy that use some applescript in VBA to get what I want in Excel VBA.

Some examples here
http://www.rondebruin.nl/mac.htm

I like to have a applescript example to mail all files in a folder and a example that mail two or three files with Apple Mail. I will try to make it work in VBA then.

Thanks

I wrote something similar to copy my ichat scripts to myself via email…






tell application "Finder"
	
	display dialog ¬
		"This will attach the items listed in" & return & "the Finder as individual emails." & return & return & ¬
		"Designed for iChat log backup, useful " & return & ¬
		"for any set of items to be attached." & return & ¬
		"Large files may take time. Please wait." & return & ¬
		"-- Written By Billie Hawkins, 2011" buttons {"Continue", "Cancel"} default button 1
	
	--set theFilepath to fullpath of newMessage
	--		set theFilename to newMessage
	
	set theEmailname to the text returned of ¬
		(display dialog "Sender Name or Title:" default answer "Your Name")
	set theEmailsender to the text returned of ¬
		(display dialog "Email Address to Send From:" default answer "user@addy.com")
	set theEmailto to the text returned of ¬
		(display dialog "Email Items To:" default answer "SENDTO@email.org")
	set theSubjectprefix to the text returned of ¬
		(display dialog "Email Subject Prefix:" default answer "iAttached Files --> ")
	
	
	
end tell

tell application "Finder"
	if selection is not {} then
		set finderfilelist to selection
	else
		set finderfilelist to choose file
	end if
end tell

repeat with newMessage in finderfilelist
	
	tell application "System Events"
		set theFilepath to container of (newMessage)
	end tell
	
	tell application "Finder"
		set theAttachment to newMessage as alias
		
		--set theSubject to the text returned of ¬
		--	(display dialog "Subject of Email:" default answer theSubjectPrefix & " " & newMessage)
		
		set theSubject to theSubjectprefix & " " & newMessage
		
	end tell
	
	tell application "Mail"
		
		set theMessage to make new outgoing message with properties {visible:false, subject:theSubject, content:"This is the content from: " & return & theFilepath & ":" & newMessage & return & return}
		tell theMessage
			make new to recipient at end of to recipients with properties {name:theEmailname, address:theEmailto}
			try
				make new attachment with properties {file name:theAttachment} at after the last word of the last paragraph
			end try
			send theMessage
		end tell
	end tell
end repeat
tell application "Mail"
	send all
end tell