Multiple attachments in 1 Entourage message?

Hi,

I am trying to configure an AppleScript for iView MediaPro that was originally written for mail.app so that it can work with Entourage. The script takes photos selected in iView, allows you to resize them, and then sends them to the mail program. I have been able to get the script to send the files to Entourage, but when I select more than 1 photo, I get a separate e-mail message for each photo. My question is: How do I script so that multiple photos are attached to just 1 message?

Here’s the portion of the script that is most relevant (as far as I can tell; I am an absolute novice when it comes to scripting):


if Convert then -- send converted files
	set ConvPict to Temp_Folder("ConvPict") -- create temp folder to receive converted files
	tell window 1 of application "iView MediaPro" to ¬
		convert images with options ("Mail " & item Noption of ConvOptions) ¬
			saving in alias ConvPict with only selected
	tell application "Finder" to set AllFiles to every file of folder ConvPict
else -- send original files
	tell window 1 of application "iView MediaPro"
		set AllFiles to {}
		repeat with theItem in selectedID
			set AllFiles to AllFiles & (path of theItem)
		end repeat
	end tell
end if
set BeginContent to return & return & item Lang of {"Sent", "Envoyé"} & " via iView MediaPro." & return
tell application "Microsoft Entourage"
	activate
	tell content
		repeat with TheFile in AllFiles
			set msg to make new draft window with properties {content:BeginContent, attachment:{file:TheFile as alias}}
		end repeat
	end tell
end tell

Any help would be greatly appreciated!

Hi Philcozz,

Instead of using the file, use the list. Something like this:

set f to (choose folder)
tell application “Finder”
try
set AllFiles to (every file of f) as alias list
on error – there is only one file
set AllFiles to ((first file of f) as alias) as list
end try
end tell
set BeginContent to “Here are the files.” & return & return
tell application “Microsoft Entourage”
activate
set msg to make new draft window with properties {content:BeginContent, attachment:AllFiles}
end tell

You don’t need the repeat, just use the list AllFiles. So you would just change this line:

set msg to make new draft window with properties {content:BeginContent, attachment:AllFiles}

and remove the repeat and tell content.

gl,

Thanks for the reply!

Well, I couldn’t get your suggestion to work with the preexisting script I’m trying to modify for Entourage. I did try your suggestion as a “folder action” script, using a third-party app to resize the images and then save them in a folder. The only problem with that is when Entourage opens I get an e-mail message for every photo such that if I resize 3 photos and they get saved in the folder, I get 1 e-mail with 1 photo, a 2nd e-mail with 2 photos, and a 3rd e-mail with all 3 photos; this is because the resizing program does 1 photo at a time so I get an e-mail each time it resizes. Is there any way to script for folder actions that puts a delay on the action?

Here’s the script that I used for the folder action

on adding folder items to this_folder after receiving these_items

tell application "Finder"
	try
		set AllFiles to (every file of this_folder) as alias list
	on error -- there is only one file 
		set AllFiles to ((first file of this_folder) as alias) as list
	end try
end tell
set BeginContent to "Here are the files." & return & return
tell application "Microsoft Entourage"
	activate
	set msg to make new draft window with properties {content:BeginContent, attachment:AllFiles}
end tell

end adding folder items to

Ah… I added “delay 5” between the first and second line of the script and it works.

Hi Phil,

What if you make it a droplet instead. does it still need the delay?

on open AllFiles – this should be the folder, I’m rushing
– add rest of script here
end open

gl,

Hi
I am also a novice in scripting - tried my first scripting now with the same goal as you philcozz - to send multiple files in Entourage created i iView. I have used your script but have to problems:

  1. Each file opened in a new message (would like to have all my selected files in one message.
  2. The script opens entourage but then return to iView so I have to switch back to entourage again.

Here is the script again…
if Convert then – send converted files
set ConvPict to Temp_Folder(“ConvPict”) – create temp folder to receive converted files
tell window 1 of application “iView MediaPro” to ¬
convert images with options ("Mail " & item Noption of ConvOptions) ¬
saving in alias ConvPict with only selected
tell application “Finder” to set AllFiles to every file of folder ConvPict
else – send original files
tell window 1 of application “iView MediaPro”
set AllFiles to {}
repeat with Theitem in selectedID
set AllFiles to AllFiles & (path of Theitem)
end repeat
end tell
end if
set BeginContent to return & return & item Lang of {“Sent”} & “via iView MediaPro.” & return
tell application “Microsoft Entourage”
activate
tell content
repeat with TheFile in AllFiles
set msg to make new draft window with properties {content:BeginContent, attachment:{file:TheFile as alias}}
end repeat
end tell
end tell

activate
if Convert then tell application "Finder" to delete folder ConvPict

end SendToMail
:shock: