Jump to content
Macro Express Forums

Variable For Control


cyberchief

Recommended Posts

I am working on the issue of getting controls in the programs we use here. The Macro that I am working on is same as the ones you see in the other threads I have posted. I am running a process that sends mailings out. It pulls the account number from a spreadsheet, and depending on the first 3 digits, decides which program to use. There are 5 programs. All of them exactly the same but are used for the different regions. Here is my question. I found a button control at the bottom of these programs with text. I was having issues when I input information, the program sometimes hangs... and the delay I have set is not always long enough. Well, the control text changes to "busy" when it is waiting. I have found that I can probably use a repeat to delay the macro until "busy" is no longer displayed. Here is what I have:

 

Repeat Until %T1% Does not contain "Busy"
 Get Control %C1% (OSCAR_EAST_SO - USWest Connect: msctls_statusbar32)
 Variable Get Control Text: %C1% to %T50%
 If Variable %T50% does not contain "Busy"
   Break
 Else
 End If
Repeat End

 

 

My question is... I don't want to have to put this code in 5 times for every delay since we have 5 different programs. Does anyone know if I can change the "OSCAR_EAST_SO - USWest Connect" to a variable in the Get Control text? I have the macro set up to set %T50% variable as the program that is being used. All 5 programs have the same name of control (msctls_statusbar32). Will it work by just putting the variable in the Get Control Window Title? TIA!!!

Link to comment
Share on other sites

I tried it using a variable for the top window control title but it does not seem to be working. I get an error that specified control C1 cannot be found, aborting Macro. Here is the code I am using:

 

  Repeat Until %T50% Does not contain "Busy"
   Get Control %C1% (%T5%: msctls_statusbar32)
   Variable Get Control Text: %C1% to %T50%
   If Variable %T50% does not contain "Busy"
     Break
   Else
   End If
 Repeat End

 

whereas, %T5% is the program in current use (1 of 5 different programs depending on the account number being used). Any ideas?

Link to comment
Share on other sites

Cyberchief -

 

I don't think that using Get Control inside the Repeat loop actually does anything. In other words, Get Control only needs to capture a control one time. Putting it in a loop would be like continually setting a variable to the same value every time the loop repeats.

 

Is the Get Control Using Text checkbox checked in the Get Control command? If so, then this may be part of the problem because Macro Express will not be able to find it until it says "Done".

 

Can you email a PrntScrn of one of five of the program windows? Do not post it. Just email it to me joe@pgmacros.com. It might help to envision what you are looking at for this, and some of your other posts.

 

Also, you can change the window title of a control. In other words, you can change which window title a control belongs to. It means that you would only need to Get Control once in your macro. Look into the Modify Top-Level Window Title of Control option.

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...