Saturday, November 18, 2017

#1 2013-12-04 06:21:57 am

timbaldwin
Member
Registered: 2006-08-14
Posts: 55

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

Offline

 

#2 2013-12-09 05:46:23 am

ccstone
Member
Registered: 2009-02-07
Posts: 409

Re: File name in Mail

Hey There,

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

Here's an Applescript that will do the job.

Applescript:

-------------------------------------------------------------------------------------------
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
-------------------------------------------------------------------------------------------

Offline

 

#3 2013-12-10 04:49:16 am

timbaldwin
Member
Registered: 2006-08-14
Posts: 55

Re: File name in Mail

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

Offline

 

Board footer

Powered by FluxBB

RSS (new topics) RSS (active topics)