I have created a Keyboard Maestro macro which outputs to the clipboard and a window the macOS version, the name of the front app and the version number of the front app. For example, for Curio:
macOS 11.2.2 - Curio, version 14.4
I use a macro provided Christopher Stone for getting the macOS version, and found through a search the following terminal command "mdls -name kMDItemVersion /Applications/" to get the version number.
The macro below works fine where the app consists of only one word.
But if the app consists of two words (such as "Keyboard Maestro" it fails). I understand in Terminal/Shell Script it is necessary to prepend spaces with an "\" and the macro adds the "\ " to any spaces in the app name.
For apps with two names, the command I create to run in the shell script works fine if I copy it run it manually in Terminal but not through the shell script command in Keyboard Maestro. For example the macro creates for Keyboard Maestro:
Running it manually in Terminal works, but not through the Keyboard Maestro script.
The Keyboard Maestro Engine Log produces the following error:
2021-02-28 08:17:34 Execute macro “applicaton ID copy” from trigger The Hot Key ⌃⌥⇧⌘F12 is pressed
2021-02-28 08:17:34 Task failed with status 1
2021-02-28 08:17:34 Task failed with status 1. Macro “applicaton ID copy” cancelled (while executing Execute Shell Script).
Thank you very much for rewriting the macro - although I cannot understand the various shell script commands you have used.
For all the Apple apps I have tried it does not provide the version number of the app. For example for Calendar:
macOS 11.2.3 - Calendar, version : could not find .
The Engine log stating the following error:
2021-03-12 10:02:39 Execute macro “Quick Macro for ⌥F1 [Quick Macro]” from trigger While the Hot Key ⌥F1 is down
2021-03-12 10:02:40 Task failed with status 1
2021-03-12 10:02:40 Task failed with status 1 In macro “Get macOS and Front Application Version Numbers 1.01” (while executing Execute Shell Script).