Take the 2-minute tour ×
Ask Different is a question and answer site for power users of Apple hardware and software. It's 100% free, no registration required.

I have an "ask for finder items" step in my Automator workflow, which produces a list of files selected by the user.

I then use these files as an input for a second step.

At that point I need to execute a bash command (third step).

In the fourth step, I need to use the original list of files as an input. How do I refer to it in Automator? Is there any pass-through for inputs?

Please note that re-ordering the steps is not an option.

UPDATE: It seems the proposed solution does not work for me:

enter image description here

share|improve this question
    
Can you get your first list of files, and can store this in a temporary text file, and then subsequently steps further down the line can point to this file for input? –  stuffe Feb 14 '12 at 17:47
    
But why wouldn't the get/set variable steps work as expected? –  Roberto Aloi Feb 14 '12 at 20:06

1 Answer 1

It's very easy to do this; all you need to do is use the 'Set Value of Variable', execute your bash script, then use 'Get Value of Variable'. You can also set multiple variables, name them, etc. as you need. Take a look at the quick example I created, which should resemble what you are intending to do. You'll notice that after I set the variable my bash script searched for files elsewhere, then after that was completed I easily recalled the variable (files a, b, c).

Automator Bash Scripting with Variables

share|improve this answer
    
Ah! Apparently I'm too old for drag'n'drop programming. Thank you for the very detailed reply. –  Roberto Aloi Feb 4 '12 at 9:46
    
Unfortunately, this doesn't seem to work for me. See update. –  Roberto Aloi Feb 14 '12 at 17:39
2  
@RobertoAloi, — Marking the answer 'not-correct' because your script doesn't work is ridiculous. The answer is correct, although without seeing your script there is no telling why you're getting the error. –  l'L'l Feb 22 '12 at 20:55
    
Even if you leave the script to a mere 'cat', the solution doesn't work for me. I've voted up your question because it's very detailed and explains the concept, but I didn't feel marking it as "accepted" straight away because it didn't work for me and it would discourage other users to post alternative solutions. I will mark it as accepted in a couple of days as "best answer" if no other answers are available. Said that, there's a section in the FAQs about etiquette and rudeness, which you might want to read: apple.stackexchange.com/faq#etiquette –  Roberto Aloi Feb 23 '12 at 11:07
2  
Simply put, I answered your question — correctly. Maybe if you would have asked it differently my response would have been more to your liking. Also, I don't need to read the FAQ, since you obviously have the definition of 'helpfulness' mixed up with 'rudeness'. –  l'L'l Feb 26 '12 at 9:40

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.