If and goto
Posted: Tue Feb 26, 2019 4:45 pm
A friendly "Hi all",
I am not really a "coder".
Though I try to compose a macro, that tests if a certain line of a text contains "A1abc" or "B1abc" or "C1abc"
If Yes I want to replace "A1abc" by "A2abc", "B1abc" by "B2abc" and "C1abc" by "C2abc".
If not I want to continue the macro at a label "Continue" without a replacing procedure.
First, I don't know whether I can use an "OR"-function e.g. if I can search for "A1abc" and "B1abc" simultaneously.
Second I can't manage to combine {If... with {Goto... successfully
This forum doesn't contain older topics where I could learn from other examples.
So I tried this:
At first the line is found and marked and copied to the clipboard
Then I wrote to the macro:
But: that doesn't work!
The macro doesn't go to the labels because the "goto" doesn't seem to work with "if".
At least I don't know the right syntax and couldn't find a matching example in the help-file.
Can anybody help me?
I am not really a "coder".
Though I try to compose a macro, that tests if a certain line of a text contains "A1abc" or "B1abc" or "C1abc"
If Yes I want to replace "A1abc" by "A2abc", "B1abc" by "B2abc" and "C1abc" by "C2abc".
If not I want to continue the macro at a label "Continue" without a replacing procedure.
First, I don't know whether I can use an "OR"-function e.g. if I can search for "A1abc" and "B1abc" simultaneously.
Second I can't manage to combine {If... with {Goto... successfully
This forum doesn't contain older topics where I could learn from other examples.
So I tried this:
At first the line is found and marked and copied to the clipboard
Then I wrote to the macro:
Code: Select all
{Var15 GetClip}{If (Var15=A1*) {Goto ReplaceA1} Else {Goto Continue}}
{Label ReplaceA1}
{Var15 Replace A1|A2}{Delay 100}
{***--- now the marco finds the certain line again and marks it---***}
{Var15}
{*** this will replace the line and "A1abc" should now be replaced by "A2abc"---actually this works!***}
{Label Continue}
{Paste nothing was replaced}
The macro doesn't go to the labels because the "goto" doesn't seem to work with "if".
At least I don't know the right syntax and couldn't find a matching example in the help-file.
Can anybody help me?