Jump to content
Macro Express Forums

REPEAT UNTIL not working...


Recommended Posts

Hello,

 

I have this script :

 

<IF WINDOW Option="\x00" Title="%persos[1]%" Partial="FALSE" Wildcards="FALSE"/>


<REPEAT UNTIL Variable="%active_window%" Condition="\x00" Value="%perso[2]%"/>


<VARIABLE SET STRING Option="\x05" Destination="%active_window%"/>
<WINDOW ACTIVATE Title="%persos[2]%" Exact_Match="TRUE" Wildcards="FALSE" _IGNORE="0x0006"/>


<END REPEAT/>


<ELSE/>

 

If I debug,
the first loop, %active_window% <> %perso[2]%
the second loop, %active_window% == %perso[2]%
But the "repeat until" don't stop !
I do not see where I could make a mistake.
(for information, if I use this method, it is because the "<WAIT FOR WINDOW TITLE Title="%persos[2]%" Partial="FALSE" Wildcards="FALSE" Indefinite="TRUE" Hours="0" Minutes="0" Seconds="0"/>" bugs with a succession of 8 windows and small delays between, like 100ms).
Link to comment
Share on other sites

I don't have time to consider this closely so I don't know if this helps but I think you misspelled a variable. Window Activate Title uses "persos" and the repeat control is "perso".

 

On another note you really shouldn't ever use repeat this way. It's better to use two macros with activation.

 

Also I consider it a bad practice to have a loop like this. It could process a million times a second and bog your CPU and make other apps unresponsive. It's better to put a small delay in. EG 100mS so it only iterates 10 times a second. Usually that's plenty.

 

Finally I never make loops that have the risk of infinite recursion. In this case I'd make it a loop of finite number which results in a tolerable wait period. For instance if I believe it should never take more than 10 seconds and I'm having it delay 100mS each iteration then I'd loop 100 times. If it finished and never got a hit, controlled by a Boolean variable I'd display an error message to the user.

Link to comment
Share on other sites

No problem, sorry for the variable, I re-read 15 times without seeing it. :angry:

Don't feel bad. I once spent two days re-reading four little lines of IBM Assembler code before I finally saw my error. :wacko:

Once you "know" what it says, your brain automatically plugs that in for you to save time. :P

Link to comment
Share on other sites

Sometimes I read things backwards to find errors. Especially proof reading things. One's brain expects to see things and is quick to accept the shape of a word more than the exact spelling.

Link to comment
Share on other sites

Slightly off topic, but just to prove the point about proof reading:-

 

Olny srmat poelpe can raed this.
I cdnuolt blveiee that I cluod aulaclty uesdnatnrd what I was rdanieg. The phaonmneal pweor of the hmuan mnid, aoccdrnig to a rscheearch at Cmabrigde Uinervtisy, it deosn't mttaer in what oredr the ltteers in a word are, the olny iprmoatnt tihng is that the first and last ltteer be in the rgh it pclae. The rset can be a taotl mses and you can still raed it wouthit a porbelm. This is bcuseae the huamn mnid deos not raed ervey lteter by istlef, but the word as a wlohe. Amzanig huh? Yaeh and I awlyas tghuhot slpeling was ipmorantt! If you can raed this psas it on !!
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...