Paste tilde separated sentences in order - maybe impossible?

Long time reader, first time poster.

What I do: I'm an audiobook engineer, which involves a lot of recorded audio that's difficult to parse simply via waveform. I've found it helpful to mark the audio files at natural breaks in the language, so that it's easily navigable.

I work in Logic Pro X. It's a highly robust audio workstation, but it seriously lacks in automation options. Right now, I have Keyboard Maestro reading a keystroke to set a marker when I click a button on an external surface controller, but I have a dream, that I can't seem to make happen.

What I am hoping: I have created a system that will parse the input file, remove all strange quirks, and place "~" as separators in the raw text file.

The dream:

  1. On keypress, Keyboard Maestro will activate Logic Pro X (✓)
  2. It will type the keystroke to create a marker in Logic Pro X (✓)
  3. It will type the keystroke to rename a marker in Logic Pro X (✓)
  4. It will paste the n-th sentence of the text file that has been parsed, stopping at the ~ (✗)
  5. It will move to the n+1 sentence
  6. Return to Step 2

Part of the reason I'm hoping that it can be some sort of counter that moves from sentence to sentence is so that, in the future, perhaps there would be a way to move back one sentence so that my narrator can repunch.
I've worked out that it either has something to do with dictionaries, or some way to split it into separate variables.
I have an iteration that works using the Split Text plugin, but that tops out at 99 variables, and also, it seems incredibly inefficient to place all of those strings into separate variables. I've attached that macro as well.
This may be impossible, or I may be using the wrong tool for the task. I have limited CS experience, and have just begun dipping my toes. Any help would be appreciated. 04%20AM 16%20AM

Sorry for the sparse nature of the existing macros, I'm still learning.
Beginning of one not working.kmmacros (10.6 KB)
One that works for 99.kmmacros (18.3 KB)Sample (7.3 KB)

Please upload a zipped file of the text file that contains these sentences. I did not see any text in either of your macros that contains the tilde "~" symbol.

Do you want to trigger the macro once, and it performs all of these Actions for all sentences in the file, OR, to trigger the macro to process for only ONE sentence, the next sentence?

Assuming that LogicProX will respond as expected from the keyboard shortcuts, KM should be able to do this task.

Sample (7.3 KB)
Sorry! Also added to the previous post.

The macro would process for only one sentence, and then upon re-triggering would process the next sentence.

That's encouraging news, by the way!

Use the For Each action and the Substrings In collection with a regular expression of:


ie, any sequence of one or more characters that are not a ~.