Help with Automator process

So id like to be able to select (by click or dragging a box to select multiple files or just R click to select single one) files on my desktop and use a quick action (by right clicking) to direct me to a parent folder, then I want to SELECT which sub folder to move the file(s). I have this simple one below, BUT, I cannot figure out how to be able to then select one of the sub-folders. Im thinking a need a script?!?!? Any help appreciated. Thank you


MacBook Pro 16″, macOS 11.6

Posted on Feb 25, 2022 6:53 AM

Reply
Question marked as Top-ranking reply

Posted on Feb 28, 2022 12:46 PM

Let me simplify this and assume that you are OK with selecting a folder when the script runs. For this you can use a 5-step workflow:


Step 1: Set Value of Variable



This captures the files passed into the script and stores them in a variable, so we can refer to it later. I called the variable FilesToMove, but it could be anything you like.


Step 2/3: Prompt for folder



This is a two-step process with some very specific settings.


First is a 'Ask for Finder Items' action. This posts the standard 'choose file' dialog for the user to select a folder.

The important settings here are:


a: Start at - set this to your Modeling folder. That way when the dialog opens, it is already set to this location (my example uses Desktop because I don't have a Modeling folder)

b: Type: Folders - this ensures that the user can select only folders.

c: Options: Ignore this action's input - this is essential otherwise it will merge this action's result with the previous action (the list of files to move) and bad things will happen in that case.


Note that because this action uses the standard Open File dialog, it is technically possible for the user to select any folder on the disk. It just defaults to the Modeling folder to make it easy for them. If this is a problem we can look at other approaches.


Once the user has selected a folder, the second part of this step stores that result in another variable (in this case named subfolder but it could be anything you like.



Step 4 retrieves the list of files from the beginning of the script using a simple 'Get Value of Variable' action:



Important parts here are:


a: Identify the variable you used to store the files from the beginning of the workflow

b: under Options, turn on Ignore this action's input, otherwise we'll have the same problem as before, where it will try to merge the two variables.


The value of the variable (i.e. the files to move) are passed into:


Step 5: Move the files



Here, the Move Finder Items action expects to be passed in a list of files to move - we just established that via the Get Value of Variable. The kicker here is that you set the To: parameter to the variable you used to store the user-selected folder. This isn't obvious, but when you use the 'Set Value of Variable' you'll see a list of variables at the bottom of the workflow window. Just drag your variable to the To: field (it's non-intuitive) and you should be set.


Hope that helps.

15 replies
Question marked as Top-ranking reply

Feb 28, 2022 12:46 PM in response to Camelot

Let me simplify this and assume that you are OK with selecting a folder when the script runs. For this you can use a 5-step workflow:


Step 1: Set Value of Variable



This captures the files passed into the script and stores them in a variable, so we can refer to it later. I called the variable FilesToMove, but it could be anything you like.


Step 2/3: Prompt for folder



This is a two-step process with some very specific settings.


First is a 'Ask for Finder Items' action. This posts the standard 'choose file' dialog for the user to select a folder.

The important settings here are:


a: Start at - set this to your Modeling folder. That way when the dialog opens, it is already set to this location (my example uses Desktop because I don't have a Modeling folder)

b: Type: Folders - this ensures that the user can select only folders.

c: Options: Ignore this action's input - this is essential otherwise it will merge this action's result with the previous action (the list of files to move) and bad things will happen in that case.


Note that because this action uses the standard Open File dialog, it is technically possible for the user to select any folder on the disk. It just defaults to the Modeling folder to make it easy for them. If this is a problem we can look at other approaches.


Once the user has selected a folder, the second part of this step stores that result in another variable (in this case named subfolder but it could be anything you like.



Step 4 retrieves the list of files from the beginning of the script using a simple 'Get Value of Variable' action:



Important parts here are:


a: Identify the variable you used to store the files from the beginning of the workflow

b: under Options, turn on Ignore this action's input, otherwise we'll have the same problem as before, where it will try to merge the two variables.


The value of the variable (i.e. the files to move) are passed into:


Step 5: Move the files



Here, the Move Finder Items action expects to be passed in a list of files to move - we just established that via the Get Value of Variable. The kicker here is that you set the To: parameter to the variable you used to store the user-selected folder. This isn't obvious, but when you use the 'Set Value of Variable' you'll see a list of variables at the bottom of the workflow window. Just drag your variable to the To: field (it's non-intuitive) and you should be set.


Hope that helps.

Mar 1, 2022 9:35 AM in response to Camelot

Camelot wrote:

Let me simplify this and assume that you are OK with selecting a folder when the script runs. For this you can use a 5-step workflow:

Step 1: Set Value of Variable


https://discussions.apple.com/content/attachment/75a46643-c736-4f4a-b08d-b4ef1d467b5a

This captures the files passed into the script and stores them in a variable, so we can refer to it later. I called the variable FilesToMove, but it could be anything you like.

So im using Files - see Post.

Step 2/3: Prompt for folder


https://discussions.apple.com/content/attachment/12955d40-9c99-4098-ad3e-20221440861d

This is a two-step process with some very specific settings.

First is a 'Ask for Finder Items' action. This posts the standard 'choose file' dialog for the user to select a folder.

Im using Files

he important settings here are:

a: Start at - set this to your Modeling folder. That way when the dialog opens, it is already set to this location (my example uses Desktop because I don't have a Modeling folder)

Modelling is the Destination Parent Folder NOT the Starting Point


: Type: Folders - this ensures that the user can select only folders.

Im Using Files


: Options: Ignore this action's input - this is essential otherwise it will merge this action's result with the previous action (the list of files to move) and bad things will happen in that case.

Note that because this action uses the standard Open File dialog, it is technically possible for the user to select any folder on the disk. It just defaults to the Modeling folder to make it easy for them. If this is a problem we can look at other approaches.

Once the user has selected a folder, the second part of this step stores that result in another variable (in this case named subfolder but it could be anything you like.


Step 4 retrieves the list of files from the beginning of the script using a simple 'Get Value of Variable' action:


https://discussions.apple.com/content/attachment/a8ea5a29-8c52-4750-ac5c-9664ead6532a

Important parts here are:

a: Identify the variable you used to store the files from the beginning of the workflow
b: under Options, turn on Ignore this action's input, otherwise we'll have the same problem as before, where it will try to merge the two variables.

The value of the variable (i.e. the files to move) are passed into:

Step 5: Move the files


https://discussions.apple.com/content/attachment/74b5fc1f-0616-4a87-be8e-081a6f0ab92e

Here, the Move Finder Items action expects to be passed in a list of files to move - we just established that via the Get Value of Variable. The kicker here is that you set the To: parameter to the variable you used to store the user-selected folder. This isn't obvious, but when you use the 'Set Value of Variable' you'll see a list of variables at the bottom of the workflow window. Just drag your variable to the To: field (it's non-intuitive) and you should be set.

Hope that helps.

I need the Task to be Accessible from the Quick Menu so it has to be Quick Action not Workflow, right ??


Tks

Feb 28, 2022 10:31 AM in response to mrchntmarine

May I didn’t explain myself enough.


the issue is not actually moving the files. The issue is HOW DOES THE SCRIPT KNOW which folder to move to.


in my recent post I offered a couple of ways of determining this.


You could use the standard ‘choose folder’ interface and have the user choose.

You could have the script get a list of all the sub folders, and let the user pick from this list.

You could have multiple variants of the script, each pointing to a different folder, and the user invokes the appropriate script.


and that’s just off the top of my head.


the outstanding question is how do YOU want the script to run (at least in an ideal world), then we can work out the logic of how to do that.


Feb 25, 2022 8:25 PM in response to mrchntmarine

I see. I interpreted your post as you wanted to select the folder to work on, rather than the destination.


i think the question at this point is what do you want?


you could have the script prompt you for a folder to select as the destination.

or the script could calculate a list of sub folders, and let you choose from a list.

or you could have different scripts for the sub folders.


you choose :)

Feb 25, 2022 9:56 AM in response to mrchntmarine

From your description it sounds like you're using this as a service (so you can select files in the Finder then crtl-click to initiate the action).


In that case the issue is more of a 'how to select multiple items in the Finder.


To do this, Click to select the first item, then hold the command key and click the second (and subsequent) items.


Now you can Ctrl-click to invoke the script.


Does that solve your issue?

This thread has been closed by the system or the community team. You may vote for any posts you find helpful, or search the Community for additional answers.

Help with Automator process

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