Activate Action Does Not Work for Starting Calibre 5

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)

I'm quite familiar with man, thanks, but not being an OSX techie I don't know what a bundle is and why you might use it instead of an app's name.

...I now know what a bundle is but I'm still unsure as to why an app can be identified in several ways and why those ways might not refer to the same thing.

You've probably seen this.

[NSBundle | Apple Developer Documentation](https://developer.apple.com/documentation/foundation/nsbundle)

The bundle ID is the most specific identifier of a particular build

1 Like

Thanks, good information there.

I'm still unclear as to why initiating /Applications/calibre.app and open -b net.kovidgoyal.calibre give different results as they are both referring to the same thing.

Or are they?

BTW, the system log contains the following

Nov 25 14:39:56 Ts-iMac com.apple.xpc.launchd[1] (com.apple.xpc.launchd.oneshot.0x10000016.calibre[14204]): Service exited with abnormal code: 2

when calibre.app is launched using the problematical KM action. Does this give some clue as to what the problem is?

I wonder if the launchd entry is pointing to an earlier/other build/instance – possibly now deleted ?

The open -b command is not tied to the actual location of the application. It works as long as open can find the application somewhere.

Unfortunately I don't know what that system log error means.

1 Like

Got it! Thanks!

Hey @tiffle,

Well – names change but Bundle IDs generally remain the same.

Not having to provide a hard path to a given resource is handy.

Different versions of the same application might have different Bundle IDs but the same name.

Like:

com.latenightsw.ScriptDebugger5
com.latenightsw.ScriptDebugger6
com.latenightsw.ScriptDebugger7

All of these are named "Script Debugger" by default, but I can address them specifically via their Bundle IDs.

A user might need multiple versions of apps on their machine for testing or for other reasons.

There are various reasons why Bundle IDs are useful, but for most users of macOS it's just esoterica.

-Chris

3 Likes

That's a great explanation... it clears up a lot! Thanks!

1 Like