1

I use Automator to do the following:

  1. ask user to choose a folder (as Service action)
  2. ask user to choose the name from the list (AppleScript choose from list ...)
  3. pass the folder chosen and the name chosen to shell-script

I understand how to pass folder chosen from step 1 to step 2. But I don't understand how to pass both variables between steps 2 and 3 (I can pass just one). I tried to return {answer, input} at step 2. But shell-script fails with the error -[__NSArrayM fileSystemRepresentation]: unrecognized selector sent to instance 0x600000654b80.

1
  • show your code and eventually a screen of your workflow. Commented Jul 30, 2017 at 14:33

1 Answer 1

2

When passing the list of parameters to a shell script action for example

return {"/Applications", "com.apple.application-bundle"}
  • $@ represents the flattened list joined by spaces -> "/Applications com.apple.application-bundle"
  • $1 represents the first parameter -> "/Applications"
  • $2 represents the second parameter -> "com.apple.application-bundle"

    and so on...

The shell script can look like

mdfind -onlyin $1 "kMDItemContentType == $2"

Note: Make sure that the parameters are passed as arguments rather than to stdin in the shell script action.

Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.