tobydobo Posted December 27, 2011 Report Share Posted December 27, 2011 Hello all, New to the forum but have been using Macro Express for a while. Never encountered a logic issue before and I just wanted to be sure Im entering the commands right. For some reason my macro continues regardless of If/End if statement. Here is what I have so far: Activate window: window name Get control %C1% (window control syntax) Wait for control %C1% to be come visible <all of the above works fine, but I need it to end there if the control does not become visible> <these commands should stop the macro if the control above is not visible, correct?> If not control %C1% visible End if <then if the control is visible, i want the following to run> Mouse double left click on control %C1% Delay 3 secs Macro Run: macro name any suggestions? Quote Link to comment Share on other sites More sharing options...
Samrae Posted December 27, 2011 Report Share Posted December 27, 2011 Maybe this: If not control %C1% visible Macro Stop End if or this: If control %C1% visible Mouse double left click on control %C1% Delay 3 secs Macro Run: macro name End if But, I think if the control never becomes visible that this command: Wait for control %C1% to be come visible would fail and halt the macro. Keep in mind that sometimes (often?) controls behave weirdly. You may not be able to see a control but it may be visible to Windows (and consequently to Macro Express). You have to test your application and adjust your macros accordingly. Quote Link to comment Share on other sites More sharing options...
tobydobo Posted December 27, 2011 Author Report Share Posted December 27, 2011 Thanks! I will give that a try and provide feedback. Quote Link to comment Share on other sites More sharing options...
tobydobo Posted December 27, 2011 Author Report Share Posted December 27, 2011 Yea I think you are right about the quirks of the controls that Windows sees. I was able to create a workaround by inserting a wait for <window title> to appear before continuing...that did the trick. Now my next challenge: Which commands would I need to use to capture text from a field on a form and then have a specific macro run based on the text from that field? Im almost there, but cant quite figure out the combination. I know I will have to use the If Variable and assign the text to a T variable of some sort but from there I have no clue. Quote Link to comment Share on other sites More sharing options...
Samrae Posted December 28, 2011 Report Share Posted December 28, 2011 Which commands would I need to use to capture text from a field on a form and then have a specific macro run based on the text from that field? When asking a new question it is better to start a new topic. I can think of two ways to get text from a field on a form. If you are able to use a control you could use the Variable Get Control Text command. If controls won't work then you need to use the clipboard. Highlight the text and Text Type <CTRL>c to copy. Then use the Variable Set String from Clipboard. Once the information is in a variable you can use the If Variable command to have your macro do different things. Quote Link to comment Share on other sites More sharing options...
tobydobo Posted December 28, 2011 Author Report Share Posted December 28, 2011 ah now that makes since. I will try it out. Thanks for the response. Quote Link to comment Share on other sites More sharing options...
tobydobo Posted December 29, 2011 Author Report Share Posted December 29, 2011 ok this is solved. Thanks for the help. Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.