Thomas Harrick
Thomas Harrick

Reputation: 1

Passing data into Automator Shell

How would I receive input using "Ask For Text" in MacOS Automator and then pass that data into part of a shell script?

i.e.

[Ask for text/folder path]
[set inputted text to variable "data"]

[run shell script: 
chflags hidden (CALL "DATA" HERE)]

I would like the above example to yield the specified folder hidden.

Upvotes: 0

Views: 432

Answers (1)

Ken Thomases
Ken Thomases

Reputation: 90671

The Run Shell Script action has a "Pass input" pop-up menu in its upper right that lets you select how you want the input from the previous action to be passed to the script. The options are "to stdin" or "as arguments".

For your case, "as arguments" is probably easiest to handle.

Then, you can write your command as:

chflags hidden "$@"

Upvotes: 1

Related Questions