You can make a difference in the Apple Support Community!

When you sign up with your Apple Account, you can provide valuable feedback to other community members by upvoting helpful replies and User Tips.

Looks like no one’s replied in a while. To start the conversation again, simply ask a new question.

Automator quick actions

Is it possible to create a quick action:


  1. Right click on empty space inside a folder
  2. Run this quick action
  3. It creates a few folders with certain names



Posted on Jan 30, 2023 11:34 PM

Reply
Question marked as Top-ranking reply

Posted on Jan 31, 2023 12:10 PM

To be fair, it's tricky, and non-obvious, thanks to how (badly) Automator handles variables, but it is doable.


Here's the workflow I created. Saved as a Quick Action, it lets you right click on a folder to select the Service, and it creates three folders within that folder.



The main steps are:


1) Workflow receives current Folder in Finder

This makes sure it reacts to a selected folder in the Finder


2) Set Value of Variable

This stores the input (the selected folder) in a variable for re-use. This is important since we want to use it multiple times (one per subfolder). I named it 'FolderName', but you can use any name you like.


3) New Folder

This creates a new folder with the given name.

The trick is you have to override the 'Where' parameter so that it creates it inside the folder that triggered the script.

To do this, look at the bottom of the workflow and you'll see a list of variables you've created (there should be only one). DRAG the variable from the list at the bottom to the "Where" field.


Repeat step 3 for as many subfolders as you need.



Note there is no error checking or handling in Automator - if there's already a same-named folder, the workflow will throw an error. You'll need to decide how critical that part is.


Note also that you can extend this if you need to create multiple levels of folders.

For example, if you wanted to create subfolders inside 'Folder 2', just capture the output of that New Folder command into a new variable, and use that as the Where parameter to another New Folder command.

Similar questions

11 replies
Question marked as Top-ranking reply

Jan 31, 2023 12:10 PM in response to Rustam_Himadiiev

To be fair, it's tricky, and non-obvious, thanks to how (badly) Automator handles variables, but it is doable.


Here's the workflow I created. Saved as a Quick Action, it lets you right click on a folder to select the Service, and it creates three folders within that folder.



The main steps are:


1) Workflow receives current Folder in Finder

This makes sure it reacts to a selected folder in the Finder


2) Set Value of Variable

This stores the input (the selected folder) in a variable for re-use. This is important since we want to use it multiple times (one per subfolder). I named it 'FolderName', but you can use any name you like.


3) New Folder

This creates a new folder with the given name.

The trick is you have to override the 'Where' parameter so that it creates it inside the folder that triggered the script.

To do this, look at the bottom of the workflow and you'll see a list of variables you've created (there should be only one). DRAG the variable from the list at the bottom to the "Where" field.


Repeat step 3 for as many subfolders as you need.



Note there is no error checking or handling in Automator - if there's already a same-named folder, the workflow will throw an error. You'll need to decide how critical that part is.


Note also that you can extend this if you need to create multiple levels of folders.

For example, if you wanted to create subfolders inside 'Folder 2', just capture the output of that New Folder command into a new variable, and use that as the Where parameter to another New Folder command.

Jan 31, 2023 9:37 AM in response to Rustam_Himadiiev

What is your ultimate goal here?


The fact you call out 'click on an empty space' makes your task impossible as written.


The Finder will not present the Services menu (and therefore access to Quick Actions) on a 'empty space' click, only when you click on an existing file or folder.


You can get this to work if you click on a folder (and have the subfolders created within that folder), but the 'empty space' requirement is a no-go.



Automator quick actions

Welcome to Apple Support Community
A forum where Apple customers help each other with their products. Get started with your Apple Account.