I need some help to put the contents of the clipboard into a new Midi Action

The Content of the Clipboard is separated by Semicolons and looks like this:

Play or Stop;2;4;16

„Play or Stop“ should be the Name of the Action

„2“ is the Note Nr.

„4“ is the Velocity

„16“ is the Midi-Channel

I hope you can give me some assistance, I have no Idea how to separate the Clipboard Content and paste the Values to a Midi-Action.

You can use Keyboard Maestro's ability to split a Variable or Token at any text symbol - in this case the Semicolon.

Assuming the Clipboard is Play or Stop;2;4;16 and you want to paste each of those 4 sections separately.

First copy the Clipboard contents to a Variable.

For this example, let’s call that Variable Local_Midi

To paste the whole of that variable in one go Play or Stop;2;4;16 you would use the syntax:

%Variable%Local_Midi% in an Insert text by pasting Action

To paste just part 1 of that Variable, Play or Stop you would use the syntax:

%Variable%Local_Midi[1];%

(Which is the Variable name followed by the part you want in square brackets, followed by the symbol you are splitting at, in this case a semicolon.)

And so on, to paste parts 2,3 and 4

%Variable%Local_Midi[2];%
%Variable%Local_Midi[3];%
%Variable%Local_Midi[4];%

EDIT - for completeness, the reason it was necessary to convert the Clipboard into a Variable rather than do a similar split on the Clipboard Token %SystemClipboard% directly is that each time Keyboard Maestro does an Insert text by pasting Action, the current Clipboard is changed to the last thing pasted. If you had wanted to split the Clipboard in one go, or only extract one of the items for pasting, or instead of pasting, used an Insert text by typing Action, it could have been done on the Clipboard Token directly:

%SystemClipboard[1];%
%SystemClipboard[2];%
%SystemClipboard[3];%
%SystemClipboard[4];%

3 Likes

I had no freaking idea that keyboard maestro can do that…:exploding_head:

Thanks for your Help...Problem Solved! :slight_smile: