Automator Issue – Get Selected Finder Items Duplicates Path

automatorfinderterminal

I'm trying to make automator quick action/service for coping text from images.

It looks like this:

enter image description here

When I run script from automator everything works fine. But when I try to run it from services menu (right click on image > Services > service_name) then it doesn't work as expected.

The problem is that "Get Selected Finder Items" returns two copies of the to the image's path. In this case ~/Desktop/t1.png ~/Desktop/t1.png. I even saved input to the script to a separate file (foo.txt) to be sure.

So the question is why this happens and how to fix it?

Best Answer

When run from the Automator app it needs the Get Selected Finder Items action, however when run as a Quick Action from Finder it isn't needed as the selected files in Finder are passed to the Quick Action.

You need to remove or disable the Get Selected Finder Items action to have the duplication stopped when run as a Quick Action.

To disable an action, check the [√] Ignore this action's input under the action's Options.