Bertie Posted March 16, 2022 Report Share Posted March 16, 2022 I've been reading up on the use of the Window Controls. I found this in my reading and wanted to follow the steps submitted back in 2005, but I can't find them in the Macro Express pro Help section. It is called "Help Topic Organizer". The instructions are unclear to me. There are 4 options: - Capture Control - saves the Window Control info in a variable that is used during playback. The "Control information" is capture during playback of the macro. use the Get Control command to obtain the control information during the create of the macro. - Clear Control Cache - - Get Control - The "Get Control Command" saves the control information in a variable. A capture utility is launched to select buttons, edit boxes, etc that can be used later in the mater. Use the Capture Control command to obtain the control information during the playback of the macro. - Set Focus - Like Window Activate. Brings window to the front and sets focus to the control. Most useful for edit box controls (I'm assuming drop downs, text boxes, etc. Set Focus on the edit box and then use the Text Type command. PS - I saw the Sample - Great Video. Walking through the Sample video: WordPad Get Control - After the Window is Open - you Get the exe of the program using the "Z" Order. Few Lines down - You "Send Text Directly to Control %variable%): text says yadda yadda yadda Notepad Get Control - using Z order %variables% I noticed that you didn't open Notepad first. So you set the variable using an Open Notepad First. Next Line of code is Launch Notepad: Why Get Control BEFORE you open the Program. You can't get focus with the Get Control then. Are there steps you follow using these "control Commands" like "Do this First, then 2nd, then 3rd" to get them to work? I've read about 25 post, but these commands are mentioned after the fact. Quote Link to comment Share on other sites More sharing options...
Cory Posted March 16, 2022 Report Share Posted March 16, 2022 I don't have much time but I'll try to give you a little understanding. I too found the name of the commands confusing, but after I learned how they work, the names make sense. Generally you're wanting to use Get Control. Controls are volatile. We see a control in an application and think "Oh, there's that control again." but to Windows it's different every time. In order to interact with a control you need it's address, called a handle. Every time you open Notepad all the controls including the form (program) are assigned a handle and it's different every time. And, in fact, you have have two instances of the program happening at the same time. The system distinguishes them and their controls with distinct handles. Here's where the Get Control made sense for me. We can't predict the handle the system will issue, so we need to wait for the controls to exist and then we need to tell MEP how to... Yup, Get the Control handle. So a control variable simply holds the address of the control. So this control address needs to be found before you can interact with said control. Bear in mind all the text boxes, buttons, and so forth are all controls in a traditional WinForm application. So MEP uses the title of the window to drill down and find the address of your text box for instance. Now that you have it, you can do things like sending a mouse click even to a button or setting it's text value if it's a text box. And they don't even need to be visible to do so. Also consider using the controls for flow control. I use Wait For Control often. It can make your macros Wikiwiki. I hope this helps. I'll follow this topic if you have more questions. Quote Link to comment Share on other sites More sharing options...
Bertie Posted March 16, 2022 Author Report Share Posted March 16, 2022 Picture is worth a thousand words - Maybe this will help. Again, been reading for 6 hrs on this and trying different stuff. I think the order is something. Sure would like to use it. Quote Link to comment Share on other sites More sharing options...
Bertie Posted March 16, 2022 Author Report Share Posted March 16, 2022 Just don't see how it's supposed to "enter text" for you. I used the Sample and edited it to fit my program "Facets". So help me connect the dots when you have time. Quote Link to comment Share on other sites More sharing options...
Cory Posted March 16, 2022 Report Share Posted March 16, 2022 Have you followed the Calculator sample? That helped me a lot. I'm trying to find it but I don't have time. In the Samples.mex there's a Using Windows Controls. You might check that one out also. Can you show me your code so far? Where are you getting stuck? So for me I start my normal macro. Then I set the Get Control command. Then maybe send some text to that control. Attached is an example. Control Example.mex Quote Link to comment Share on other sites More sharing options...
Cory Posted March 16, 2022 Report Share Posted March 16, 2022 Jinx. You owe me a Coke. LOL Use this macro. I forgot to mention first open Notepad. I get the control handle then I send text to it. 2 macro commands. Remember, getting the address of the control is like looking up the number in the phone book. One still needs to make the call. Quote Link to comment Share on other sites More sharing options...
Bertie Posted March 16, 2022 Author Report Share Posted March 16, 2022 Hi Cory, Sorry for the delay. I'll buy you a case of Coca Cola. But here in the South....everything is a Coke. BTB (Back to Business): Your comment reads..."Use this Macro". You didn't mention the name and nothing's attached. So are you referring to your post above that with the "Control Example.mex"? I'll check it out and then let you know. If you meant to attach another one, please do so and I'll check back a little later. Thanks again for your help. Quote Link to comment Share on other sites More sharing options...
Cory Posted March 16, 2022 Report Share Posted March 16, 2022 Where I grew up we soft drinks were "pop". It took me a long time to adjust to "soda" here in Cali. I was really confused when I discovered that many people call a Dr. Pepper or a Pepsi a "coke". Seems confusing to me but... Maybe it was a conspiracy by Coca-Cola. I attached "Control Example.mex" to my message. See screenshot attached. Just open it in MEP and look at the macro therein. Then open up Notepad and run the macro. Quote Link to comment Share on other sites More sharing options...
Bertie Posted March 16, 2022 Author Report Share Posted March 16, 2022 Thanks Cory - You are the Best. Quote Link to comment Share on other sites More sharing options...
Cory Posted March 16, 2022 Report Share Posted March 16, 2022 You're welcome. Let me know if that helps you understand. I think control based macros make macros shorter, more capable and more reliable and I hope everyone will try to learn them. I went for years avoiding them becasue I initially didn't get it, then after learning how to use them I was kicking myself for not learning sooner. They make macro development much easier. Also great for macros that can do things without disrupting the user. 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.