OK, I am now going to try to teach you to fish 🙂
It might be a little bit easier to visualize if you think of the values passed along in your workflow as a stack of playing cards. Some actions do something with the cards and then just pass them on, some take all of the cards, and others add cards to the stack. The
Set Value of Variable action takes the current stack of cards (the results of any previous action(s)), assigns it to a variable that is named whatever you want to name it, and passes the stack on to the next action. The
Get Value of Variable gets the value of one of your previously named variables and adds it to the stack. You can also use a previously named variable in input fields of various actions, such as locations to copy to. I'm not sure why you are getting the path to the desktop (unless that is where your workflow application is located), but here are some additional comments for my previously posted workflow:
1) Run Applescript (with the Applescript posted earlier)
- if your workflow has been saved as an application, the results of this action will be a path to the folder that it is in (if not, the path will be to where the Automator application is, which isn't what you want)
2) Set Value of Variable
- this action will take that path, assign it to a variable with your specified name, and pass it on
3) New Folder
- this action makes a folder with the specified name in the specified location - you can drag variables into these fields, in which case their current values are what will be used
- the result of this action is a new folder, and the path to the folder is added to the current stack of cards (if any) and passed on to the next action
- since we just want the path to the new folder (and none of the previous cards), first we throw away any cards we may have (with the "ignore input" option) so that our results don't get mixed up.
4) Set Value of Variable
- same as (2) above, except that the value is now the path to the folder that got made in the previous action (3)
5) Ask for Finder Items (Type: files, Allow Multiple Selection)
- the results of this action will be whatever items you selected, and of course, they will be added to our current stack of cards unless we throw them away first with the "ignore input" option
6) Copy Finder Items
- this will copy Finder items (the ones we selected in the previous action) to the location that is specified - you can drag a variable into the
To: field, in which case it's current value is what will be used.
- the result of this action will be the paths to the items that were just copied, but since this is the end of the workflow it doesn't matter
You can use the
View Results action to see what the current stack of cards is, so you can see if what is going in and coming out of your actions is what you expect, and tweak accordingly.