Clean-up DELETE KM Variables @KM8

Use Case

  • It is easy to build up a long list of KM Variables that you really don't need.
  • However, there may be some Variables, some with a common prefix, that you do want to keep.
  • This makes it easy to remove (delete) those Variables you don't need.
  • IMO, a best practice is to use Local and Instance Variables in all Macros where you don't need the Variable for subsequent executions or for other Macros.
    • Doing this will greatly help keep your Variables environment small and clean.

MACRO:   Clean-up DELETE KM Variables @KM8

~~~ VER: 2.0    2018-07-01 ~~~

DOWNLOAD:

Clean-up DELETE KM Variables @KM8.kmmacros (41 KB)
Note: This Macro was uploaded in a DISABLED state. You must enable before it can be triggered.

As always, please feel free to post any comments, issues, and/or suggestions you may have concerning this macro.


This is a minor modification of this Macro by @Tom
Delete All Variables Except. . .

Thanks for a great macro, Tom.


You May Also Be Interested in these Macros:


:bangbang: Warning!

This macro Makes Major UnRecoverable Changes to Your KM App

  • It DELETES Many/Most of Your KM Variables
  • You may want to backup your KM Variable DB at
    ~/Library/Application Support/Keyboard Maestro/Keyboard Maestro Variables.sqlite

Example Output

image

image


ReleaseNotes

Author.@JMichaelTX based on Macro by @Tom

PURPOSE:

  • Delete All KM Variables NOT on Prefix List

REQUIRES:

  1. KM 8.2+
    .
  2. macOS 10.11.6 (El Capitan)
  • KM 8 Requires Yosemite or later, so this macro will probably run on Yosemite, but I make no guarantees. :wink:

NOTICE: This macro Makes Major UnRecoverable Changes to Your KM App

  • It DELETES Many/Most of Your KM Variables

  • You may want to backup your KM Variable DB at
    ~/Library/Application Support/Keyboard Maestro/Keyboard Maestro Variables.sqlite

  • You need to test further before using in a production environment.

  • It does not have extensive error checking/handling.

How To Use

  1. Open KM Editor App
  2. Make sure KM Preferences window is closed.
  3. Trigger this macro.

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. ??
      .
  1. Assign a Trigger to this maro..
  2. Move this macro to a Macro Group that is only Active when you need this Macro.
  3. ENABLE this Macro.
    .
  • REVIEW/CHANGE THE FOLLOWING MACRO ACTIONS:
    (all shown in the magenta color)
    • Set to List of KM Variable Prefixes that You do NOT Want to Delete

TAGS:

USER SETTINGS:

  • Any Action in magenta color is designed to be changed by end-user

ACTION COLOR CODES

  • To facilitate the reading, customizing, and maintenance of this macro,
    key Actions are colored as follows:
  • GREEN -- Key Comments designed to highlight main sections of macro
  • MAGENTA -- Actions designed to be customized by user
  • YELLOW -- Primary Actions (usually the main purpose of the macro)
  • ORANGE -- Actions that permanently destroy Variables or Clipboards,
    OR IF/THEN and PAUSE Actions

USE AT YOUR OWN RISK

  • While I have given this limited 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 Debugger from the KM Status Menu, and step through the macro, making sure you understand what it is doing with each Action.

2 Likes