Split - String Into Variables (\N) Macro

Split - String into Variables (\n) Macro (v10.2)

OK Thanks for all your help. Here is what I ended up with.

Take a look and make any suggestions to make it simpler, quicker, better? I just needed a utility that would take a varying number of lines and split them.

Split - String into Variables (-n).kmmacros (8.0 KB)

Rather than separate variables, you could also use Keyboard Maestro Variable Array indexes.

See the section in manual:Variables [Keyboard Maestro Wiki] on custom delimiters.

I think @peternlewis may be planning to support the newline character \n directly as a custom delimiter, but in the meanwhile you can replace all \n with a character (or string of characters) which are not present in the text itself.


One-based index to particular lines.kmmacros (4.3 KB)

2 Likes

That's a much better solution thanks a lot.

I guess I need to read the manual more but sometimes I don't even know what the right question is.

Again Thanks
Roger

1 Like

KM is a large and rich resource – asking here is probably the most efficient route to a solution for any given input -> output problem that arises.

3 Likes

:sunglasses:

This is precisely why it's best to provide an overview of what you're trying to accomplish when asking for help.

Frequently people focus too much on the minutiae of a problem, and there are better methods available to complete the overall task.

So...

  • Keep asking questions.
  • Take good notes.
  • Study when you need to.
  • Keep example macros.

What you learn fades if you don't use it often, and keeping good memory aids around saves a lot of repeated work.

1 Like

Often (understandably, but it costs time) on the minutiae of a failing "solution", with which they are too preoccupied to offer examples of:

  1. What they are starting with, and
  2. what they want to get to.
1 Like