knurling / ServiceStation

Service Station
37 stars 1 forks source link

How to use selectedItemURLs in Automator Workflows? #14

Closed Tekl closed 4 years ago

Tekl commented 4 years ago

The Variable selectedItemURLs seems to be a string surrounded by parentheses. Actions like copying the selected files don't work with this.

pkamb commented 4 years ago

If you press the Sample Scripts button, the resulting directory will have a Scripts readme as well as samples for the 4 script types.

The automator workflow there will display the values of the 3 variables when run.

selectedItemURLs is passed in as an array of the selected file URL paths. This is displayed as a parentheses-wrapped list of quoted paths:

Screen Shot 2020-04-16 at 4 31 02 PM

You are right that this list is not parsed correctly/expectedly by some Automator actions.

"Open Finder Items" works for the single targetedURL variable, but not for the array of selectedItemURLs:

Screen Shot 2020-04-16 at 4 29 11 PM

That "Open Finder Items" action should take multiple items...

I'm investigating how to get those URLs into the correct Automator multiple item list format on several scripting forums. I also opened an Apple DTS ticket for the same question.

pkamb commented 4 years ago

I'm still unsure why the multi-path array variable is unable to be read by Open Finder Items and other actions, as detailed in the SO question above.

However, I'm going to begin additionally sending the selected files as input to the automator workflow. This will work more like a Service, with no need to grab the data from variables before using it. I'll continue to set the variables as well if they are declared in the workflow.

Look for that in the next App Store update, which I'll be submitting very soon.

pkamb commented 4 years ago

Version 2020.3 was released to the Mac App Store this morning:

No need to Get Value of Variable anymore (although the variables are set if included). It now works much more like a Service, with the selected files and folders passed as input.

I'd love to hear how this update works for your Automator workflows @Tekl

Tekl commented 4 years ago

Whoohooo. Thanks a lot. It works well. Btw. a way to open or reveal scripts from within Service Station would be a great addition.

gingerbeardman commented 4 years ago

@Tekl perhaps that last comment is covered by #8 ?