10.4: 10.4.3 update may break Automator workflows

Nov 01, '05 06:31:00AM

Contributed by: robg

Tiger only hintIf you have Automator scripts that combine Finder actions with shell scripts, you may have some problems with 10.4.3. In particular, it appears that the 'Get Selected Finder Items' action has changed its behavior under 10.4.3, and not for the better. I've also come up with a bit of a kludge solution for the problem, but at least it works.

In a nutshell, the problem is that the path returned by Get Selected Finder Items isn't usable by the Run Shell Script action. So if you have a script that first gets the selected Finder items, and then tries to run a shell script on the selection, it will fail. I ran into this with my Autmator action for this hint, which worked fine in 10.4.2, but broke in 10.4.3. Read on to see what I've figured out thus far, along with my hacky solution.

To help debug the problem with my workflows, I inserted the View Results Automator action, to check on the returned values for various actions. When I used the 'Get Selected Finder Items' action for a chosen folder in the Finder, the View Results box looked like this:

{folder "TestBurn" of folder "Hints" of folder "personal"
 of disk "datastore" of application "Finder"}
This looked like an AppleScript path to me, not a shell-usable path. So I set out to try to find another way to send a selection to my Run Shell Script action. Instead of getting the selection, I switched to the Ask for Finder Items action, with the Type pop-up set to Folders, and the Allow Multiple Selection box checked. This presents a standard file selection dialog on the screen, from which you choose the itme(s) to be used. When I ran this one, the View Results box showed me this value:
{alias "datastore:personal:Hints:TestBurn:"}
This looked more like a shell path to me, so I then re-added my Run Shell Script action, and ... everything worked! Clearly, the path being returned by Get Selected Finder Items is not usable by the Run Shell Script action, but the Ask for Finder Items returns a workable path. Unfortunately, popping up a selection dialog box for every workflow isn't a very workable solution. So I went looking for a workaround, and surprising myself, managed to find one. It turns out that if you take an action, any action, on the Finder selection, then the path will be correct. What's the best action to add? One that doesn't do much of anything -- Label Finder Items, with the label set to None. So my final workflow now looks like this:

That's the 'make burnable' script I use, and it now once again works in 10.4.3. Unfortunately, the 'make unburnable' bug that I discussed in the above-linked hint still exists -- I can't unburn the folder once it's been switched. Ah well, maybe 10.4.4...

Comments (8)


Mac OS X Hints
http://hints.macworld.com/article.php?story=20051101073100820