4

I have created an Automator quick action. The quick action listens for highlighted text on any application and runs some shell script based on the highlighted text. The quick action can be triggered by:

  • selecting text on any application
  • right click Services
  • click on name of the Quick Action

The quick action or service works fine

However, I would like to disable everyone from reading the source code of this quick action. For eg. if I install this quick action on another person's MAC, the person can go to the Library folder and view the source code of this "quick action". I would like the source code to be private.

Is there any way I can achieve this?

Note that the "quick action" should still work as it is without anyone looking at the source code of the quick action.

3
  • 5
    Can I ask why you want it to be hidden? Is it just to stop people messing with it, or because the code is commercially valuable? – benwiggy Mar 14 at 9:10
  • Workflows can’t be hidden like that, but an AppleScript-based Automator action can be created in Xcode and made run-only. That will remove the script text, but if someone is determined enough that would only slow them down a little. Text constants would also still be readable, for example the text strings passed to a shell script. – red_menace Mar 14 at 18:26
  • @benwiggy both, its because I'd like to stop people messing with it since it is commercially valuable. – Omkar Joshi Apr 18 at 11:00
5

Yeah, no. When you deliver an interpreted script, people always get to see the code - by design. This is the same for workflows and Automator and shortcuts as it is for perl and bash and python.

Unless and until there is a compiler to convert your source code into machine language and then strip the source names (or obfuscate and tokenize them) even compiled code often comes with source code to aid in debugging.

This is one of the most powerful aspects of scripts that people can see them and know what they do. This enables security validation, “fitness for purpose” checks and easy iteration / comprehension / debugging / adaptation. If you don’t want people to check your work a compiled program allows that on a technical level (or at least requires more work to analyze a binary).

Transparency is baked into this tool chain so you might need another setup if your needs dictate privacy of the code.

3
  • Can I use something other than an Automator script to accomplish the same functionality? All I want to do is read highlighted text on any application and display dialogs based on some logic. Can I use some other deliverable, maybe like a background process which may help me achieve this? – Omkar Joshi Mar 14 at 11:23
  • Yes you can! @OmkarJoshi You now have two problems. 1. The tooling for compiled programs is more complicated than for scripts, so you will have to invest time in learning. 2. This isn’t a site for programming. Only scripting. The programming site is stckoverflow.com and they have great guidance on MCVE so be sure to read the tour here and there as you begin your programming journey. Initially, it’s cheaper to pay someone to make a program for you long-term it’s very satisfying to do it yourself.. – bmike Mar 14 at 12:50
  • 1
    Worth saying that "All you want to do" is to override the default behaviour of every NSTextView object, which is non-trivial, unless you use the frameworks Apple provides. One is Automator. The other is App Extensions, which would require making some kind of app, and then an extension that hooks into the OS to provide the app's function everywhere. – benwiggy Mar 14 at 13:15
3

Generally, Automator workflow (and even applications) are designed to be opened and edited.

And a workflow has to be read to be executed. You may be able to obscure the text in some way to prevent casual inspection.

There may be other ideas here:

https://stackoverflow.com/questions/15757357/i-want-a-shell-script-to-be-executable-but-not-readable

3
  • I saw that I can written my code in apple script and export that as an application. When I export it as an application, I believe the script becomes non-readable. Hence, earlier I was going to call a ruby / python script from automator via a shell script. Now, I could call a mac application via the shell script. Wouldn't that do the trick? – Omkar Joshi Apr 18 at 11:03
  • @OmkarJoshi No, you can open Automator applications in Automator. – benwiggy Apr 18 at 12:17
  • Yeah, makes sense. Let me get to the crux of the question. How do I create a paid commercial application which involves an Automator app? To be specific, I would like to read text from ANY application which is where I use the Automator service. – Omkar Joshi Apr 18 at 17:24

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .