Activate Action Does Not Work for Starting Calibre 5

I am using the ebook app calibre. Since I upgraded to version 5 the Activate action in the following macro does not work:

When I trigger the macro calibre's app icon briefly jumps and that's it. Plus after a few seconds I get the notification "Action timeout exceeded."/

Please note:

  1. Only starting the app fails. Switching to the already running app works as before.
  2. I have reselect the new calibre app in the action dropdown, but still when I trigger teh macro the app doesn't start up.
  3. Staring the app via Finder-doubleclick or via Alfred works flawless.

Activate calibre plain.kmmacros (1.9 KB)

I had a look at it.
On macOS 10.15.7 Calibre 5.5.0 I get the same behaviour. Changing the ' Match by' in the selection of the application doesn't change a thing.

No error in the KM log.

In the macOS system log I get this error:
(com.apple.xpc.launchd.oneshot.0x1000004a.calibre[13223]): Service exited with abnormal code: 2

Perhaps this helps someone else with further troubleshooting.

I downloaded calibre and made a macro to Activate calibre.

Worked fine.

Do you really have calibre installed at /Applications/Optional/calibre.app?

I would try re-selecting the calibre app in the dropdown next to the word "Activate" in the macro action, and see if that helps.

I installed it using Homebrew. And it is installed at /Applications/calibre.app.

I did try this again:

  • reinstalled calibre using Homebrew
  • created a new macro using Activate action
  • ran the macro

The first time I ran the macro I got the message about calibre being downloaded from the internet. I choose open. And then.... nothing and the KM action time out message.

I'm not the OP and don't use calibre myself so this is just out of curiosity: why do you expect it in /Applications/Optional/ ? And does KM expect it there?

I use calibre and so I had a quick look and I also suffer from the problem I initiate Calibre from the KM macro (posted above) and nothing happens for 20 seconds and then KM times out.

So I thought I'd initiate Calibre differently like this:

KM 2 2020-11-24_12-06-13

and when I now run the macro, Calibre runs properly!

I don't know why this makes a difference. Instead of Default Application you can also specify Finder (as per the action's help information) and that works for me too.

That's where the macro from the first post points to.

I would expect it to be in /Applications/ and I would think Keyboard Maestro would too. If it was in /Applications/ and then was moved to another folder, that might explain why it wouldn't launch.

Would that cause KM to throw an error if the app wasn’t where it should be, as opposed to just timing out? My installation of calibre is definitely in /Applications but I get this odd behaviour too.

I don't think it would throw an error necessarily, but I haven't tested it. It might just quietly fail.

I just tried it by renaming calibre.app to something else and then running the KM macro. KM shows a notification and there's an error in the log file.

Yes I do.

Good that Activate works for you - shame that it doesn't work for me.

I have plenty of apps in /Applications/Optional and I can start them all with KM. I just have to select the app in the Activate menu while it is running, but then it can be launched via Activate even when it is not running

Cool. Thanks. Open action is definitely a option I look into! :slight_smile:

Strange though that Activate doesn't play nicely just with calibre...

I think it's probably worth checking with @peternlewis on this one, perhaps he can figure out what's going on.

Some cross platform applications behave in strange ways, and it would not surprise me if Calibre was one of them.

Ah, learned something new today :tada:: looking at the source of the macro can tell me more :slight_smile:
Thanks!

Thanks for chiming in @peternlewis!

calibre is certainly cross-platform. But why can Alfred switch to and launch it. Does KM use a different mechanism?

If it is not running, Keyboard Maestro uses:

[[NSWorkspace sharedWorkspace] launchApplicationAtURL:url options:0 configuration:@{} error:nil];

If it is running, Keyboard Maestro uses:

 SetFrontProcessWithOptions

based on the ProcessSerialNumber, which allows the option to reopen the windows or not.

I downloaded it and give it a go – and have exactly the same problem.

I ended up using an Execute a Shell Script action with:

open -b net.kovidgoyal.calibre

-Chris

That looks somewhat mysterious and clever to me :slightly_smiling_face:

What is that second argument to the open command?

See, in Terminal.app

man open

PS for rather more legible (PDF) versions of command line manual pages, you can use:

e.g.

open.pdf.zip (69.8 KB)