Automator quick actions
Is it possible to create a quick action:
- Right click on empty space inside a folder
- Run this quick action
- It creates a few folders with certain names
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.
When you sign up with your Apple Account, you can provide valuable feedback to other community members by upvoting helpful replies and User Tips.
Is it possible to create a quick action:
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.
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.
Camelot wrote:
To be fair, it's tricky, and non-obvious, thanks to how (badly) Automator handles variables, but it is doable.
Shortcuts is better with variables, and can also be set up as a Quick Action:
To set up as a quick action:
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.
EDIT:
Thanks for reply!
My goal is to create some folder structure inside the selected folder. But I didn't realise it can create a subfolder inside the selected folder. May you please explain how?
Thank you! Perfect!
I don't understand the logic behind this to create it by myself. How can tell the Shortcuts app to create a folder inside the folder I right clicked on?
It’s a Finder Quick Action (the (i) in the above screenshot)
Choose a Folder, Right-click and in Quick Actions you’ll see the shortcut
Yes, I get it. I am asking about an explanation why does it work this way :-). To create such actions by myself. Is there good manual or tutorial explaining how to work with variables?
Here is how my macro look.
Automator quick actions