How to use automator services in Fluid-created apps in Mojave

applicationsautomatorservices

I was having an issue with Spotlight and an Apple support person had me "upgrade" to Mojave and now I'm pissed off. None of my Automator services work in my Fluid Apps anymore! I have about a half-dozen Fluid apps so I can either assign them to all desktops (and not affect other browser windows) or so I can have multiple sessions with some websites that only support 1 browser window open to their site (e.g. the galaxy web app). I have over a dozen automator services that are extremely useful. Most accept selected text "from any application" and do various things with that text (e.g. report stats on selected nucleotides).

Now, when I try to run a service on selected text in a Fluid-created app, I get an error that states 'The action “Run AppleScript” encountered an error: “Not authorized to send Apple events to System Events.”'. If these services were apps, I could easily add them in system preferences to Security & Privacy -> Privacy -> Accessibility, but they are workflows installed as services (located in ~/Library/Services/) and thus cannot be added. I have added the Fluid-created apps, but that doesn't stop the error either.

I spoke with Apple Support and they indicated that the Fluid-created app won't work with services because of code-signing. The app has to be from an apple-recognized developer in order to be allowed access!

I fully understand the security concern, but this is very frustrating. Does anyone know how to allow services to work in Fluid-created apps?

enter image description here

UPDATE: I have tried adding the app (e.g. "Galaxy1.app") to both the Accessibility and Full Disk Access sections of the security and privacy system preference page and I still get the error:

enter image description here
enter image description here

Best Answer

I figured out a work-around for part of my problem. I'm not going to select this (my own) answer because it doesn't solve the entire problem. The main reason I use Fluid to wrap galaxy in an "app" is because you can only have 1 galaxy browser window open. If I have 2 open, changes made in 1 window affect the other, so when I'm working on 2 different projects concurrently, I was using separate Fluid apps to keep the projects from stepping on one another's toes. I knew that private browser windows could also accomplish this, but I liked the convenience of a dock icon.

So I just worked out an Applescript, saved as an app, that opens a new private Safari window to galaxy.princeton.edu. I then added that app to Security & Privacy -> Privacy -> Accessibility. This script is slightly simplified from what I actually used:

tell application "Safari" to activate

tell application "System Events"
    keystroke "n" using {shift down, command down}
    delay 0.5
    keystroke "http://galaxy"
    key code 47
    keystroke "princeton"
    key code 47
    keystroke "edu/"
    keystroke return
end tell

Note, depending on your accessibility preferences, Applescript will not type numbers, dots, or a few other characters, thus the key code 47 for the dots.

Now, whenever I run this "app" (which I gave the galaxy icon), it will open a new Safari browser window to galaxy.

This allows me to run my automator services on DNA strings in galaxy because Safari can be given permission to send apple events to System Events.app, whereas Fluid apps can't (I believe because they're not code signed).