Jump to content
Macro Express Forums

If,else,or ?


koden

Recommended Posts

In my macro I have some inf. copied to T3.

 

This inf. can be 6 diff. text/numbers.

It's always the same 6 text/numbers (5 diff. numbers and 2 diff. text)

 

I have a macro for each text.

 

So in my main macro I would like to make an IF command that does this:

 

IF T3 contains

text1 or part of

Then run macro1

???????

IF T3 contains

text2 or part of

Then run macro2

??????

IF T3 contains

text3 or part of

Then run macro3

 

a.s.o.

 

 

But what am I going to use between each IF??

 

else,or

 

or something else???

Link to comment
Share on other sites

If your macro is properly structured, then there is no need for "anything between".

 

Macex will continue on with the next command if the IF T3 contains statement is false.

 

If one of the statements is true (T3 matches something), then one of your macros will be run. After that, any remaining IF statements will still be evaluated, but nothing will happen, assuming T3 doesn't match anything else.

 

The question is: what do you want done if T3 doesn't contain any of the text you're looking for?

Link to comment
Share on other sites

Lemming is correct. Just make sure to place an end if after the macro run command or you will have an embedded if statement that will skip all of the if statements if the first statement is not true.

 

The or command would be used to check two statements such as: if T1 contains "This" OR if T2 Contains "That".

 

The else statement is used if all of your other if statement are false.

Link to comment
Share on other sites

Okay.

So it has to look like this:

 

IF T3 contains text1

text type xxxxxx

end if

IF T3 contains text2

text type yyyyyy

end if

IF T3 contains text3

text type zzzzzzz

end if

else

macro stop

end if

 

1. Do I need delays anywhere??

2. When I use contains will it then check for text1, even is there is more words in T3 ?

Link to comment
Share on other sites

Okay.

So it has to look like this:

 

IF T3 contains text1

text type xxxxxx

end if

IF T3 contains text2

text type yyyyyy

end if

IF T3 contains text3

text type zzzzzzz

end if

else

macro stop

end if

 

1. Do I need delays anywhere??

2. When I use contains will it then check for text1, even is there is more words in T3 ?

1. If you're refering to keystroke speed, you can use the KeyStroke Speed command. Macex can send keystrokes too fast for some programs. The default value is 0. Larger values will lead to slower keystrokes.

 

2. Yes, the contains will match any substring within T3. For example, if your command is

IF T3 contains fun, it would be true if:

 

T3 = Let's have some fun.

 

But it would also be true if:

 

T3 = The funeral is scheduled for today.

 

So make sure this is what you intended. Note that there is also an Ignore Case option to narrow/widen the match.

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Loading...
×
×
  • Create New...