Conform evangheliei după Matei, cu ce era îmbrăcat Isus când a fost dus spre răstignire?
a) Haina stacojie;
b) Hainele Lui;
c) Dezbrăcat;
d) O haină de in.
I want to add each line to a variable in order to be able to use it later.
P.S. clipbord (the text) wil change, but the structure remains the same.
Eg.
FirstVariable = Conform evangheliei după Matei, cu ce era îmbrăcat Isus când a fost dus spre răstignire?
SecondVariable = a) Haina stacojie;
...
...
fifthVariable = d) O haină de in.
I’m surprised nobody has suggested using the third party plug in “Split Text” for this problem. I’ve used it on a number of occasions. It’s by @ianthekirkland and you can find it here;
Since you're dynamically assigning a variable number of lines in the clipboard to individual variables RegEx is not really the best tool for this task. RegEx cannot dynamically change the number of captures in a pattern.
Here's a relatively simple macro that will assign each line in the clipboard to a numbered variable.
textVar_1
textVar_2
textVar_3
...
Copy your text.
Run the macro.
Examine the Variables panel in the KM preferences for the listed variables.
==EDIT – New version v1.03 posted 2021/03/27 16:51 CDT==
Now then – the pitfall with this is that the variables are not ever deleted.
That means that subsequent runs of the macro will overwrite the existing variables, and that can be problematic if it doesn't overwrite ALL of them – you can end up with extraneous variables.
So – we need to know a bit about your workflow to decide the best place to do variable housekeeping.
To delete them en-mass you can do something like this:
Well, just a guess but I’d apply the plug in twice: the first to split the input at (a) to get two variables as output and then apply it again on the 2nd variable to get the (a) (b) (c) etc parts. That’s possibly easier to achieve for someone who isn’t familiar with regex.
I don't really get it what each step is doing. I see that you've create a variable from clipboard, but I don't understand the var_VariableIndex and var_ClipboardLine what it does? in fact the entire For Each thing.
I Would like to understand each step.
What I do with the macro? I create online quizzes and it's quite exhausting to repeat for each question - Select first line... COPY... SELECT... PASTE... so on.
First and foremost I think you need to explain in more detail what your workflow is. The more we know about it, the more likely we'll be able to offer fruitful suggestions.
If you haven't read this it's worth a couple of minutes of your time.
Thank you. Very useful video.
From there I’ve managed to find a solution by my self. That was the hard part. And you guys provided so many solutions. Great community!