1

I have to create services for two different use cases:

  1. Mark a folder or file and zip it using an archiver tool such as rar7zip.
  2. Mark a text and open a translator app.

I've been trying to use Automator and but when selecting the new added service from Services context menu nothing happens. When I look at ~/Library/Services I do see my new services but with workflow extension and not service.

The steps I did for creating a service for the first use case:

  1. In Automator - select Service
  2. Drag the relevant app from the Applications folder
  3. Choose: "files or folders" in the appropriate drop down and Finder.app in the second drop down.

For the second use case I selected "text" and "any application".

What am I doing wrong?

slhck
  • 235,242
user49204
  • 153

1 Answers1

1

When you drag an application to Automator, you're creating a Get Specified Finder Items action. Don't drag them onto Automator, but launch them e.g. from a Run Shell Script or Run AppleScript action. The Launch Application action does not accept file arguments in my testing.

Using Run Shell Script, which receives input as arguments, it looks like this (using CleanArchiver as a substitute):

open -a CleanArchiver "$@"

It also depends on your application what they do when they receive files as input. If your archiver (which I won't buy to test this) automatically bundles them up, you're good. Otherwise you need to workaround the program's limitations.

Note that you can create .zip archives from any file selection's context menu in Finder.


It's not possible to pass selected text as arguments to a program launched e.g. using Launch Application. You need it to be AppleScriptable, or first e.g. write the text to a file. It depends on the application (which you don't even mention). Some options I mention in this and this answer, using web sites in both cases.

Note that for Translation Tab, you already have a service that can translate the selection, and don't need to create one yourself. See the App Store screenshots. It's called Translate Selection with Translate Tab.

Daniel Beck
  • 111,893