File name in Mail

Hi

Sorry, I am new to Automator and can use some help.

I wish to select a file then generate a new mail with the name of that file in the subject field.

Is this something i can do in Automator?

Thanks

Hey There,

I’m not going to bother with Automator (although it should be doable).

Here’s an Applescript that will do the job.

-------------------------------------------------------------------------------------------
try
	
	tell application "Finder"
		set sel to selection as alias list
		if sel ≠ {} then
			set _file to first item of sel
			set _name to name of _file
		else
			error "No files were selected in the Finder!"
		end if
	end tell
	
	tell application "Mail"
		set newMsg to make new outgoing message with properties {subject:_name, visible:true}
	end tell
	
on error e number n
	set e to e & return & return & "Num: " & n
	tell me to set dDlg to display dialog e with title "ERROR!" buttons {"Cancel", "Copy", "OK"} default button "OK"
	if button returned of dDlg = "Copy" then set the clipboard to e
end try
-------------------------------------------------------------------------------------------

Thanks Chris

Thought I would have to resort back to applescript… Just figured this was the kind of thing that the variables in Automator was for.

Tim