1 year ago

#261488

test-img

Bumpyride

Does EmEditor support conditionals and loops in a macro?

I am trying to create a macro that examines each line in a file and then performs different actions depending on some condition, for example: if condition A is true then ... else if condition B is true then ... and then repeats for the next line, until reaching the end of the file (EOF).

I haven't found any references for that in the manual or the Macro Reference, so I am working around it by creating a separate macro for each single condition, including a search string. I then run the macros sequentially using the Run with Temporary Options... menu and setting the Repeat Count to some arbitrary high number greater than the number of lines in the file, as well as setting the Stop if Search Fails option.

Not very elegant and a bit error-prone but it gets the job done. I suppose a plugin would be a better way to do this but that involves some additional programming complexity, which I am trying to avoid. Using 64-bit Pro v21.5.2.

macros

emeditor

0 Answers

Your Answer

Accepted video resources