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 regex
pattern, 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:
- CSV format KM arrays manual:Variables [Keyboard Maestro Wiki]
- JSON format KM arrays manual:JSON [Keyboard Maestro Wiki]
REQUIREMENTS
- This plugin has been tested so far on macOS Catalina, with Keyboard Maestro 9.2
INSTALLATION OF CUSTOM ACTION PLUGIN
- 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
- Drag the .zip file onto the Keyboard Maestro icon in the OS X toolbar.
USE OF CUSTOM ACTION IN A KEYBOARD MAESTRO MACRO
- 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” - Adjust the settings of the custom action, choosing the file path,
project name, and TaskPaper 3 item format that you want. - 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
- Rob Trew - Twitter @ComplexPoint