MacMost Now 429: Using Automator to Create Services

You can use Automator to create scripts that appear in the right click menu. This example shows you how to build a workflow that attaches the current file to a new email message.

Video Transcript
Hi this is Gary Rosenzweig now. In today's episode lets use an automator to create a service. This episode of MacMost Now is brought to you by Gazelle. Gazelle is the easiest way and fastest way for you to sell or recycle your gadgets. Whenever an item gets an offer and you get paid to be environmentally responsible. Use promo code: MacMost2 for 5% bonus. Now I know you have got that box of old cell phones and gadgets lying around.So, go to Gazelle.com and see what you can get from them.So, I get many requests for more automated tutorials. So, today let us look at creating a service.A service is something that will usually appear when you right click or Control Click on an item, say a file or a piece of text. So today, lets create a automator script that will allow you to attach a file to a new email message.
Now here is a file sitting on the desktop. Now you can right click or control click on it and get a contextual menu that has many different things that you can do with that file. Now some of these things will be added by applications and services that you add to your mac. Others would be here by default. We can add some here by creating a service in the automator. Lets query one here that will create a new email message with the file attached. So, when I run automator I first get to choose a template. So, in this case, I want to choose a service. Now once I do that, one of the things that a service will ask me for, is this bit of information at the top, of what the service receives and what application it will be used in. So, in this case, lets say we want to receive a file or folder. And lets say we want to use this in the Finder. And that kind of defines where the service will appear. So now we want to create the scrip. So now we want to have mail create a new message and then attach the file to it. So we will take a look at only the mail scripts here and then we can use the search field to quickly get to things. So we can type new and so there is the new mail message scripts, and we will drag that in. Here we go. And we leave all the stuff blank here so that we get it filled in. And then we go and do the next thing, which will be to attach, so we are going to do add attachments to the front message, but that is the next part of the script. And that is all we need to do. So now the next thing we need do is save it. Now we will be asked to save as a service, give it a name. So, new message with file. And we save it. And that is it. And on the mac we are going to put it in the right place so that it appears in the control click or right click contextual menu. So we now move the automator menu out of the way and move this file back in here and we can control click on it and see that here at the bottom, there is the new message with file that we created. We select it and it will launch mail, create a new message and right there is the file that we have attached. In case you ever want to edit one of the services you have created, you can go into your user folder, into library and then look for services, and then you will find the ones you have created there. And you can open that up in automator again and edit it.
Another useful script could be to simply leave out that first part and simply give you some ability to attach a file to the message you are currently composing. Here is another variation where I have added the create archive action before everything else, so it should create an archive with the files I have selected and then attach it to a new email message. So, I could save that and then try it out, select both of these, control and add message with file, and now what I get here you can see is, archive.zip and its got both of those of files that I have selected in there. So, that you have looked at creating automator to use services. So until next time, this is Gary Rosenzweig with MacMost Now.

Comments: 22 Responses to “MacMost Now 429: Using Automator to Create Services”

    Mike
    7/27/10 @ 5:06 pm

    Hi Gary,

    My Automator does not give me an option to create a service.
    It gives me a Select a starting point to open new workflow:

    Custom Files&Folders Music&Audio Photo&Images Text

    How can I get Automator to give me the options to create a service?

    Thanks

      7/27/10 @ 6:16 pm

      Are you using Snow Leopard (Mac OS X 10.6.x)? My guess is that you are using Leopard (Mac OS X 1.5.x).

        Dylan
        10/19/11 @ 6:09 am

        So, does this mean that it’s not possible to create a service in automator if you’re running anything earlier than than OS X 10.6.x?

          10/19/11 @ 6:43 am

          No. It is just a different set of steps.

    Raul
    7/29/10 @ 10:22 am

    Hi Gary,
    I was wondering if there is a way in the Pages Software to match the properties of a selected text just like the Brush palette in MS Word?

    Mike
    7/29/10 @ 3:09 pm

    Yelp, your right.

    System Version: Mac OS X 10.5.8 (9L30)

    R. Henry
    7/30/10 @ 9:09 pm

    What a great tip!! Thank you

    Tak
    8/4/10 @ 12:59 pm

    This is so cool!!! Thank you Gary :)

    Brian
    8/10/10 @ 8:18 pm

    Hi Gary, I created a service to ‘send to email’ which works great, but I wanted to go further and automatically insert the filename into the email subject line. I couldn’t figure out how to do this after Google searching. Any tips?

    Much appreciated. Love your show.

    Brian

      8/11/10 @ 6:28 am

      No tips for you there. I’d just keep experimenting with the Automator commands. Not sure if you can do it, though.

    Calvinator
    10/1/11 @ 2:43 pm

    Hi Gary, thanks again for the great tips; I use them ALL the time!
    I want to automate a right-click service that says “Move to Folder ” The only option at this point is to “Move to Trash”. Well, no thanks, I want to move to a folder. Any ideas?
    js

      10/1/11 @ 7:22 pm

      Yes, you should be able to do that. Give it a try. Play around with Automator and I’m sure you’ll figure it out.

    sangbea choi
    12/16/11 @ 12:58 am

    I wonder about “save as plug-in”.
    is this same as “services”? Because I want to use in illustrator 5.1.
    I saw one of videos you doing record “watch me do” with earlier version.
    so, if i use “services” same as “save as plug-in”?

      12/16/11 @ 7:37 am

      Which version of Automator are you using? In Automator for Lion you choose the type of Automator file you want to create when you start. There is no “plug-in” but there are”Print Plug-In” and “Image Capture Plug-In” choice. When you select one, it tells you what it does in the description below.

    sangbea choi
    12/16/11 @ 8:57 am

    sorry, I didn’t explain well.
    I use macbook pro with lion system. when I saw the video that you doing record “watch me do”. there was “save as plug-in > plug-in for script menu” menu and in earlier version. the video is NO.247.
    automator in lion hasn’t “save as plug-in” menu. how can I create the plug-in for script and make keyboard shortcut in illustrator program. I really hope there is way. really need it.

      12/16/11 @ 10:06 am

      That was an old video, way before Lion existed (Leopard or Snow Leopard). I think what you want now is a service. See episode 429. http://macmost.com/using-automator-to-create-services.html
      But creating something for use by Adobe Illustrator depends on whether that app supports applescripting and services. Consult its help files to see if it mentions that. It may not support it at all. If it does, then it may give you instructions on what it can do.

        sangbea choi
        12/17/11 @ 1:09 am

        Thanks for your advice!!
        But, I don’t understand one thing steel. “App supports applescripting and service”
        What does it mean? Does it mean the app is able to updates(uncracked app)?
        I did “watch me do” in illustrator and saved. It can be found a library folder(image Capture>Aplecation>workflow>Library(hidden one)). useless?

    Colin
    4/22/12 @ 6:33 pm

    I am trying to create a service with Automator running Leopard. My goal is to create a service to print a file without having to open its parent app first. I want to have so I can right-click a file and print it. SInce I am in Leopard, I do no get the Services Template.

    I drag “Print finder items” to the right side, but cannot see the option to set the “Service receives selected” popup menu to “files or folders” in “Finder.” Any ideas?

      4/22/12 @ 7:31 pm

      You can’t print a document without some app to interpret the data file and render something to be printed.

    Chefintc@gmail.com
    5/8/12 @ 4:32 am

    Hi Gary,
    The tips are GREAT! Is there a way to script this for a web mail account like gmail?

    Joel

      5/8/12 @ 6:40 am

      You can try it, but it would be difficult to do for a web-based service. However, you can always use Gmail inside the Mac Mail app. Why not do that?

Comments Closed.