Entourage open attachment script

i am trying to make a script and save it to my entourage script menu
that can be run with an attachment of a message selected will open that attachment in (choose from list) application


set this_file to the selected attchment of the selected message -- this is my problem
set app_list to {"Adobe Photoshop 7.0", "Acrobat Reader", "preview"}

tell application "Finder"
	open file this_file using application file (choose from list app_list)
end tell


I see some more problems. Try this:

tell application "Microsoft Entourage"
	set selectedMsg to (current messages)
	set selectedMsg to item 1 of result
	set msgAttachment to attachments of selectedMsg
	set msgAttachment to result's item 1
	
	set attachmentName to name of msgAttachment
	set attachmentFile to ((path to desktop) & attachmentName) as text
	
	--> save message to disk before we open it
	save msgAttachment in attachmentFile
end tell

set app_list to {"TBB6", "8BIM", "CARO"}
set selectedApp to (choose from list app_list) as text
tell application "Finder"
	open file (attachmentFile as text) using application file id selectedApp
end tell

i will try this one later but i do have another entourage question

how can i coerce a list into file attachments


on open theList
tell application "Microsoft Entourage"
		make new outgoing message with properties {recipient:"jbradfield@chemicon.com", subject:"New Literature", attachment:(list theList)}
		--the_body}
		set messID to the result
		--send messID
	end tell
end open

A list is a list. So, this will do the job:

on open theList
	tell application "Microsoft Entourage"
		make new outgoing message with properties {recipient:"jbradfield@chemicon.com", subject:"New Literature", attachment:theList}
	end tell
end open

duh! tooooo simple
we laways miss the obvious things by trying to overthink them

thanks again

now back to this one

is there a way to make it open the selected attachment rather than the first attachment

ie i have a message with 2 jpgs attached and i want to run this script with the second file only or just the third file (if there were 3) which but vary each time ( inother words i may not want just the 1st file to be executed with the script

i hope that i explained myself well enough

Hmmm… I’m not sure, but I think that Entourage doesn’t support a “selection” property for attachments, but only for folders and messages… So you can’t know what is the selected attachment :cry:

i reworked some of the code to prompt for which attachment you want

although it does need some error hanfdling i think it will work like this


tell application "Microsoft Entourage"
	set selectedMsg to (current messages)
	set selectedMsg to item 1 of result
	set msgAttachment to attachments of selectedMsg
	--set theList to the result's items as list
	set num to display dialog "which number attachment would you like" default answer "1"
	set theOne to the text returned of the result
	set msgAttachments to msgAttachment's item theOne
	
	set attachmentName to name of msgAttachments
	set attachmentFile to ((path to desktop) & attachmentName) as text
	
	--> save message to disk before we open it
	save msgAttachments in attachmentFile
	
end tell

set app_list to {"TBB6", "8BIM", "CARO"}
set selectedApp to (choose from list app_list) as text
tell application "Finder"
	open file (attachmentFile as text) using application file id selectedApp
end tell

there is probably a better way to do this but it will work for now

not to mention it would more thqan likely be faster to just drag to the desktopthen use an open with

or drag to a folder with an action to open with

like this



on adding folder items to this_folder after receiving these_items
	tell application "Adobe Photoshop 7.0"
		activate
		open these_items
	end tell
end adding folder items to


but TIA for any additional input