SUBROUTINE: 𝗌.𝘂⇾PlatformVersions, v2.0

PURPOSE

This subroutine returns version information for Keyboard Maestro and macOS.

PARAMETER

local__ReturnContents

If one of the following integers is specified, a single line of text is returned that includes the value indicated.

1 : Keyboard Maestro KeyboardMaestroVersion, e.g., Keyboard Maestro 11.0.2

2 : KeyboardMaestroVersionFloat, e.g., 11.02

4 : macOS productName productVersion (buildVersion), e.g., macOS Sonoma 14.2.1 (23C71)

8 : productName, e.g., Sonoma

16 : productVersion, e.g., 14.2.1

32 : buildVersion, e.g., 23C71

64 : productVersionFloat, e.g., 14.21

Multiple lines of text can be returned by specifying an integer that is the sum of two or more of the above integers. For example, if 5 (1+4) is specified, the following will be returned:

Keyboard Maestro KeyboardMaestroVersion
macOS productName productVersion (buildVersion)

For example,

Keyboard Maestro 11.0.2
macOS Sonoma 14.2.1 (23C71)

If 127 is specified, all seven lines will be returned. For example:

Keyboard Maestro 11.0.2
11.02
macOS Sonoma 14.2.1 (23C71)
Sonoma
14.2.1
23C71
14.21

Note: I use KeyboardMaestroVersionFloat (local__ReturnContents = 2) or productVersionFloat (local__ReturnContents = 64 ) in If Then Else or Switch/Case (with a Calculation Condition(s)) when I have logic that needs to vary depending on Keyboard Maestro or macOS versions, respectively.

TESTED WITH

• Keyboard Maestro 11.0.2
• Sonoma 14.2.1 (23C71)/MacBookPro18,2
• Sonoma 14.2.1 (23C71)/VariableMacBookPro16,1
• Mojave 10.14.16/Macmini6,2
• High Sierra 10.13.6/iMac11,1445

VERSION HISTORY

1.0 initial version

2.0
a) Streamlined the conversion to KeyboardMaestroVersionFloat and productVersionFloat; for example, with the latter 14.4.1 to 14.41. The subroutine is slightly more efficient, but the output is identical to v1.0.
b) Added a ‘Note’ to the PARAMETER section to describe the purpose of KeyboardMaestroVersionFloat and productVersionFloat.
c) To verify that this subroutine has been properly upgraded, added a call to s.𝗸𝗺⇾CheckSubUUID. This subroutine is suggested by not required. For more information, refer to: Avoiding Upgrade Issues with Submacros and Subroutines


UPGRADING THIS MACRO

If upgrading from an earlier version of this submacro, it is imperative to first delete the older version prior to importing this version into Keyboard Maestro. Note that calling macros do not need to be deleted.

Download: 𝗌.𝘂⇾PlatformVersions.kmmacros (55 KB)

Macro-Image


Macro-Notes
  • Macros are always disabled when imported into the Keyboard Maestro Editor.
    • The user must ensure the macro is enabled.
    • The user must also ensure the macro's parent macro-group is enabled.

System Information
  • macOS 14.4.1 (23E224)
  • Keyboard Maestro v11.0.2

Download: CALL 𝗌.𝘂⇾PlatformVersions.kmmacros (17 KB)

Macro-Image


Macro-Notes
  • Macros are always disabled when imported into the Keyboard Maestro Editor.
    • The user must ensure the macro is enabled.
    • The user must also ensure the macro's parent macro-group is enabled.

System Information
  • macOS 14.2.1 (23C71)
  • Keyboard Maestro v11.0.2

Related Information

If you have a macro that needs to be tweaked based on Keyboard Maestro and/or macOS version(s), it's handy to have a quick reference to the following:

Keyboard Maestro Version Requires
11.0.2 macOS 10.13+ High Sierra; Intel or Apple Silicon
10.2 macOS 10.13+ High Sierra; Intel or Apple Silicon
9.2 OS X 10.11+ El Capitan; Intel or Apple Silicon
8.2.4 OS X 10.10+ Yosemite; Intel
7.3.1 OS X 10.10+ Yosemite; Intel
6.4.8 OS X 10.8+ Mountain Lion; Intel
5.3.2 OS X 10.6+ Snow Leopard; Intel
4.3.2 OS X 10.5+ Leopard; PowerPC or Intel
3.5 OS X 10.4+ Tiger; PowerPC or Intel
2.1.3 OS X 10.3.9+ Panther; PowerPC or Intel
1.2.3 OS X 10.0+ Cheetah; PowerPC

For the latest, Keyboard Maestro information refer to: Stairways Software: Download Links

macOS

macOS No macOS Name Release Oldest iMac Oldest MBPro Oldest MBAir Oldest MB/PB
14.0 Sonoma 2023-09 iMac 2019 MBPro 2018 MBAir 2018 MB 2017
13.0 Ventura 2022-10 iMac 2017 MBPro 2016 MBAir 2018 MB 2017
12.0 Monterey 2021-10 iMac 2015 MBPro Early 2015 MBAir 2015 MB 2016
11.0 Big Sur 2020-11 iMac 2014 MBPro Mid 2012 MBAir 2013 MB 2015
10.15 Catalina 2019-10 iMac 2012 MBPro Mid 2012 MBAir 2012 MB 2015
10.14 Mojave 2018-09 iMac Late 2012 MBPro Mid 2012 MBAir Mid 2012 MB 2015
10.13 High Sierra 2017-09 iMac Late 2009 MBPro Mid 2010 MBAir Mid 2010 MB 2010
10.12 Sierra 2016-09 iMac Late 2009 MBPro Mid 2010 MBAir Late 2010 MB 2010
10.11 El Capitan 2015-09 iMac Mid 2007 MBPro Mid 2007 MBAir Late 2010 MB 2009
10.10 Yosemite 2014-10 iMac Mid 2007 MBPro Mid 2007 MBAir Late 2010 MB 2009
10.9 Mavericks 2013-10 iMac Mid 2007 MBPro Mid 2007 MBAir Mid 2011 MB 2009
10.8 Mountain Lion 2012-07 iMac Mid 2007 MBPro Mid 2007 MBAir Late 2010 MB 2008
10.7 Lion 2011-07 iMac Mid 2007 MBPro Mid/Late 2007 MBAir Late 2010 MB 2007
10.6 Snow Leopard 2009-08 iMac Early 2006 MBPro Mid/Late 2006 MBAir Early 2008 MB Late 2006
10.5 Leopard 2007-10 iMac G4 MBPro Mid/Late 2006 MBAir Early 2008 MB Late 2006
10.4 Tiger 2005-04 iMac G4 n/a n/a PB G4 2005
10.3 Panther 2003-10 iMac G3 n/a n/a PB G4 2003
10.2 Jaguar 2002-08 iMac G3 n/a n/a PB G4 Titanium
10.1 Puma 2001-09 iMac G3 n/a n/a PB G4 Titanium
10.0 Cheetah 2001-03 iMac G3 n/a n/a PB G4 Titanium

Disclaimer: The SetApp version of TypingMind (Setapp GPT-4 Turbo) was used to generate the above table. The Sonoma data was retrieved using Edge Copilot.

6 Likes

I've updated the OP with Version 2.0 of 𝗌.𝘂⇾PlatformVersions:

  • Streamlined the conversion to KeyboardMaestroVersionFloat and productVersionFloat; for example, with the latter 14.4.1 to 14.41. The subroutine is slightly more efficient, but the output is identical to v1.0.

  • Added a ‘Note’ to the PARAMETER section to describe the purpose of KeyboardMaestroVersionFloat and productVersionFloat.

  • To verify that this subroutine has been properly upgraded, added a call to s.𝗸𝗺⇾CheckSubUUID. This subroutine is suggested by not required. For more information, refer to: Avoiding Upgrade Issues with Submacros and Subroutines

If upgrading from an earlier version of this submacro, it is imperative to first delete the older version prior to importing this version into Keyboard Maestro. Note that calling macros do not need to be deleted.

I have some macros that require alternate logic that depends on the version of Keyboard Maestro, others that depend on the version of macOS.

For macros that I never plan to share, it's convenient to use subroutine 𝗌.𝘂⇾PlatformVersions with parameter ReturnContects 2 and 64, respectively and compare it to a specified respective version.

When sharing macros, subroutine dependance adds some level of complication, thus I normally skip the subroutine and embed the actions.

For convenience, I've added two groups of such actions to my Favorite Actions (Actions > Add to Favorites). These groups include the framework to:

  1. set the minimum version for the primary logic,

  2. determine the active version, and

  3. add the conditional logic.


Download: Keyboard Maestro Version Conditional Logic.kmactions (10 KB)

Macro Actions-Image

Keyboard Maestro Export


Download: macOS Version Conditional Logic.kmactions (10 KB)

Macro Actions-Image

Keyboard Maestro Export