[JXA] Template -- KM Macro (v9.2)

MACRO:   [JXA] Template -- KM

-~~~ VER: 1.0    2021-06-11 ~~~
Requires: KM 8.2.4+   macOS 10.11 (El Capitan)+
(Macro was written & tested using KM 9.0+ on macOS 10.14.5 (Mojave))

DOWNLOAD Macro File:

[JXA] Template -- KM.kmmacros
Note: This Macro was uploaded in a DISABLED state. You must enable before it can be triggered.


ReleaseNotes

Author.@JMichaelTX

PURPOSE:

  • Provide a standard JXA template to use with all scripts dealing with KM
    • Already has the code and function to get and set KM Variables.
      (Typicator snippets provided to aid in this.)
    • Has Error Trapping/Handling (Try/Catch) built-in to ensure you know about all errors back in KM.
    • Makes it easy to plug in a few lines of code for a specific purpose.
    • The Script Properties (attribution) are set in JXA variables at the top of the script.
      • This allow them to easily be used in Error Handler reports and elsewhere.

HOW TO USE

  1. First, make sure you have followed instructions in the Macro Setup below.
  2. See the below "How to Use" Comment Action
  3. This macro can be used "as is" OR customized per your preferences.

MACRO SETUP

  • Carefully review the Release Notes and the Macro Actions
    • Make sure you understand what the Macro will do.
    • You are responsible for running the Macro, not me. ??
      .
      Make These Changes to this Macro
  1. If you wish, Change the Trigger assigned to this Macro .
    • Default is: ;jxa.t.km𝍖
  2. Move this macro to a Macro Group that is only Active when you need this Macro.
    • Default is VSC, Script Editor, BBEdit (and Script Debugger athough it can not be used there).
  3. ENABLE this Macro, and the Macro Group it is in.
    • For more info, see KM Wiki article on Macro Activation
      .
  • REVIEW/CHANGE (OPTIONAL) THE FOLLOWING MACRO ACTIONS:
    (all shown in the magenta color)
    • Set to JXA Template Script (Change if desired)
      • You are prompted for the key Script Properties that will change for each script, including Author, so this should work well as is.

REQUIRES:

  1. KM 9.0+ (may work in KM 8.2+ in some cases)
  2. macOS 10.12.6 (Sierra)+

TAGS: @JXA @Script @Template @KM

USE AT YOUR OWN RISK

  • While I have given this a modest amount of testing, and to the best of my knowledge will do no harm, I cannot guarantee it.
  • If you have any doubts or questions:
    • Ask first
    • Turn on the KM Macro Debugger from the KM Status Menu, and step through the macro, making sure you understand what it is doing with each Action.

5 Likes