Jump to content
Macro Express Forums

Repeat Using C Variables


Recommended Posts

I have a macro with an argument that checks if the control text in C5 is visible.


This is meant to close any dialog boxes that might pop up in the course of forcing this dog of a data entry application to speed things up, but the amount of dialog boxes varies from record to record.


I notice there are no "C" variables in the "Repeat until" command in the scripting editor... is there a way to edit it in the direct editor to look to see if the C5 control is visible before exiting the loop?


Right now I just have an argument copied over 8 times to cover the maximum amount of dialog boxes that might appear, but its a little too crude for my picky sensibilities.




/3 posts in two days... boy, I must seem very lazy! :-\

Link to comment
Share on other sites

In cases like these I create an infinite loop and use other means to control the egress. At the end of the loop I owuld create an "If C5 Visible" conditon and inside that If-Endif section put a Break command.

Link to comment
Share on other sites

Hi, Cory!


Thanks for the suggestion, I actually got down and fixed this about 5 mintues after posting... not so lazy after all!


Here is my crude, yet simple solution which I put in a macro without activation and then ran it from within other Macros as an "applet":


Repeat Until %T39% = "8"

If Not Control %C1% Visible

Repeat Exit

End If

Delay 50 Milliseconds

Repeat End



The "8" means nothing of course... the real condition that is being sought is "If Not Control %C1% Visible".


So the macro happily loops and loops until the network lag finally clears the closed window allows the remaining code to continute unmolested.

Link to comment
Share on other sites



Just a small suggestion... because I, like you, like order in my macros...


Rather than using Repeat Until %T39% = "8" for infinite loops, I use "Repeat Until %T1% <> %T1%"... basically, repeat until T1 does not equal T1... since T1 will always = T1... it will keep going until another set of requirements have been met. Just a suggestion to keep it clean. I use this quite frequently. And you will never have to worry about using up a variable.

Link to comment
Share on other sites

As long as we're bing tidy you might want to use Break instead of Repeat Exit. It works in all types of repeats and I think Repeat Exit is just there for reverse compatibility.

Link to comment
Share on other sites

CC- Your suggestion actually hurt my head since I'd been out last night celebrating my cleverness. I like how you have the computer debate whether the chicken or the egg comes first while secretly, the loop is craving for ham.


Cory- Duly noted, my code now has a break in there instead.


Thanks! :-)

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.

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.

  • Create New...