SPLIT :: Custom plugin – Split a String to a KM Array

Second draft – updated to enable splitting of multi-line strings.

SPLIT a string to a KM array.zip (8.7 KB)

NAME

  • Split a String to a KM Array

VERSION

  • 0.02
    • 2021–02–07 Updated to handle multiline input strings.

SYNOPSIS

The string specified in the String to split field is split wherever the given Delimiter sub-string appears, to form a Keyboard Maestro Array variable.

NOTES

The Delimiter pattern can be a plain literal string, or a regular expression regexpattern, as selected in the Delimiter type option.

The output KM Array can either:

  • in a simple comma-delimited csv format,
  • or in a json Array format (in which string values are double-quoted)

For KM tokens which return the length and numbered items of a KM Array variable, see the following sections of the manual:

REQUIREMENTS

  • This plugin has been tested so far on macOS Catalina, with Keyboard Maestro 9.2

INSTALLATION OF CUSTOM ACTION PLUGIN

  1. If updating a previous version of the action, first manually remove the
    previous copy from the custom actions folder at:
  • ~/Library/Application Support/Keyboard Maestro/Keyboard Maestro Actions
  1. Drag the .zip file onto the Keyboard Maestro icon in the OS X toolbar.

USE OF CUSTOM ACTION IN A KEYBOARD MAESTRO MACRO

  1. In macro-editing mode, click the green New Action button, select the
    Third Party Plugins smart folder in the left hand panel of the Actions List
    and choose the “Split a String to a List”
  2. Adjust the settings of the custom action, choosing the file path,
    project name, and TaskPaper 3 item format that you want.
  3. Test the macro. If notifications are enabled on your macOS system, or you
    have changed ‘Display results briefly’ to ‘Display in a Window’ at the
    bottom of the custom plugin, you will see a brief summary of the result.

CONTACT

1 Like