For Each LocalLine In a Variable LinkList
Set URL to Localline
Loop {
If 1 is pressed, append "1" to variable TextToPaste
If 2 is pressed, append "2" to variable TextToPaste
If 3 is pressed, append "3" to variable TextToPaste
} Until TextToPaste has changed
Append linefeed to TextToPaste
If I accidentally hit the wrong button and I want to load the previous link and undo the addition of the last line. I can delete the last line in TextToPaste with regEx but I don't know how to return to the previous line in the variable LinkList
One solution is to confirm the "TextToPaste" variable BEFORE you actually paste it and move on to the next "LocalLine".
Maybe something like this:
For Each LocalLine In a Variable LinkList
Set URL to Localline
set variable keyPressed to "NO" ### INSERT
Loop {
If 1 is pressed,
set variable keyPressed to "YES" ### INSERT
append "1" to variable TextToPaste
If 2 is pressed,
set variable keyPressed to "YES" ### INSERT
append "2" to variable TextToPaste
If 3 is pressed,
set variable keyPressed to "YES" ### INSERT
append "3" to variable TextToPaste
### INSERT THIS ACTION
If variable KeyPressed is "YES"
Prompt for User Input
"Accept and Continue?"
"TextToPaste:" %Variable%TextToPaste%
with Buttons "OK" and "Cancel"
} Until TextToPaste has changed AND text `%PromptButton%` is "OK" ### CHANGE
Append linefeed to TextToPaste
That pseudo code is probably not perfect, but should give you the idea, the method.
I simplified my original pseudo code ( I should probably stop doing that ) , I actually do have a confirmation button using a similar system, but sometimes I still make an error despite pressing the confirmation button.
Do you think there's not anyway to return to the previous line in the for each action?
I don't use a KBM user prompt for speed of workflow reasons, I use a second keybind as a confirmation button.
No, there is no way to do this without adding a lot of extra Actions that store the previous value of the look variable, "LocalLine".
Hmm, after thinking about this I don't think it wouldn't be too tricky to create an undo button for undoing a single input, but it would be me much trickier for it to work multiple times.
I could imagine this isn't a simple endeavor and am in no way requesting anyone to do this but I am curious if this is within the realm of possibility with scripts.
Frankly, I don't understand what you are trying to achieve with your Macro. Maybe if you upload your macro it would be clearer to the rest of us.
From experience, I have to say that when the logic of any process becomes this convoluted, it is often best to step back and re-evaluate the design. Maybe there is a simpler way to achieve your objectives.