Automator Issue

Discussion in 'Mac Programming' started by superscape, May 9, 2014.

  1. superscape, May 9, 2014
    Last edited: May 9, 2014

    superscape macrumors 6502a

    superscape

    Joined:
    Feb 12, 2008
    Location:
    East Riding of Yorkshire, UK
    #1
    Hi,

    I wonder if anyone can help? I'm having a problem where a workflow that works fine when run in Automator works differently when saved as a service. It's quite a complex workflow, but I've made a simpler one which replicates the issue (see attached).

    In short, the attached workflow looks at the open contact in Contacts.app and makes a new TextEdit document. It then looks up and appends the person's name to the TextEdit document. Next it looks up and appends the person's job title to the TextEdit document. (I know I could look them up all in one go, but I need to do it like this for the more complex workflow).

    When I run them in Automator then I get what I expect:

    John Doe
    Managing Director


    However, when I save it as a Service for Contacts and run it from Contacts' Services menu then I get:

    John Doe
    1234-12324-1234
    johndoe@acme.com
    John Doe
    1234-12324-1234
    johndoe@acme.com


    I'm confused. Am I doing something dumb here? Any suggestions/thoughts would be welcome.

    Thanks in a dvance
     

    Attached Files:

  2. Red Menace macrumors 6502

    Joined:
    May 29, 2011
    Location:
    Littleton, Colorado, USA
    #2
    In a regular Automator workflow, you usually need to include actions to get the items to work with. However, when using a workflow that connects with the system in some way (service, folder action, droplet, etc), the system will pass the appropriate items to the workflow.

    If your service workflow is set up the same as the regular one, the solution is to remove or rearrange the actions that get additional items so that you don't get doubled items.
     
  3. superscape thread starter macrumors 6502a

    superscape

    Joined:
    Feb 12, 2008
    Location:
    East Riding of Yorkshire, UK
    #3
    Ah... I *think* I see! Thanks for the info.

    So it's naive of me to think I can just copy the contents of a 'normal' workflow into a service workflow and expect it to work?

    Thanks
     
  4. Red Menace macrumors 6502

    Joined:
    May 29, 2011
    Location:
    Littleton, Colorado, USA
    #4
    Well, like I mentioned, if a workflow already has actions to get stuff to work with, then you will wind up with extra/doubled items if you just drop it into a service. If you aren't interested in the items passed to the service workflow (you just want it in the services menu, for example), you can set the first action to ignore its input, but normally a service works with the items it was selected with.
     
  5. kryten2 macrumors 6502a

    Joined:
    Mar 17, 2012
    Location:
    Belgium
    #5
    Don't know how complex your workflow is but it seems kind of tedious to look at the open contact in Contacts.app to get the info you want. I would dump all the info into a text file.
     

    Attached Files:

Share This Page