0

I created a shortcut that does some processing of images using Pixelmator.

The first action is Get contents of folder myfolder and then the processing begins. This processing works fine, but now I want to use the Shortcut on the command line to process folders.

According to the documentation, Shortcuts can be run from the command line:

To run the “Combine Images” shortcut combining all the images on the Desktop to a PNG file, you could use the following: shortcuts run "Combine Images" -i ~/Desktop/*.jpg -o ~/Desktop/combined.png

I want to modify my Shortcut to accept a variable for the folder to process and then specify that folder on the command line.

How can I do that?

2 Answers 2

0

From the shortcuts(1) man page:

shortcuts run shortcut-name-or-identifier [--input-path input-path ...] The input to provide to the shortcut. Can be dropped, or set to "-" for stdin. 
0

In the Shortcuts app, you need to use the Shortcut Input variable before the option to set the input will appear.

For example, add a Get contents of folder action to a shortcut. In this action, right-click the blue Folder and select Shortcut Input.

Then, Receive Images and 18 more input from Nowhere will appear at the top of the window. Click Images and 18 more and then choose Select all, Deselect all, and then check Folders under Documents.

You can also customize the no input behavior to ask the user to specify a folder.

Then you can run the shortcut from the command line: shortcuts run my-shorcut -i myFolder

You must log in to answer this question.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.