Jump to content
Macro Express Forums

Selecting a Button


Recommended Posts

Trying to find a better mouse trap for selecting a Button. Bad joke!

1. I Activate the window first.

2. Second I have to click a location in the window.

a. My Window is: "Robert's Help"

b. Location of button: is x621 y1030

I was thinking of using "Mouse Click on Control". I don't remember seeing this function in the past. It sounds interesting. My problem is the Variable stuff is over my head. I'm hoping for some help tonight.

Bob

Link to comment
Share on other sites

Unfortunately Mouse Click on Control requires the use of control variables. But variables are not that difficult of a concept and I urge you to try and do it. In this example all you need to do is launch the Get Control command, have your button visible, and click the Launch Utility command in the command, Drag and drop the crosshairs on the button and save, then “Store the control in” and define a variable. That will create one line of code. Now the next line will be Mouse Click on Control which you will reference that variable again.

 

Controls and exactly how it all works is an advanced subject but this is the cool thing about MEP. The authors have made it so easy anyone can do it. And controls are cool. You don’t even have to have the app visible to interact with them. Also you can read text, set text and all kinds of things. BTW in your program folder there’s a samples.mex file in your program folder called Calculator and Notepad that demos the use of controls.

 

But if my suspicions are right you’re going to want a ‘simpler’ solution instead. I put simpler in quotes because of course it’s not really. If you have an application window where the button never moves you can activate your window, Mouse Move relative to window, and left mouse click.

Link to comment
Share on other sites

  • 1 year later...

I'm creating a new Macro Express Pro Man and I'm a newby. I opened the application and figured out that the <alt> key grabs the file button in the upper left hand corner. From there, it seems like I can use a combination of the <tab> and <down arrow> keys to navigate the menus.

 

How do I save them to %variables% that I can return to by %name%?

 

Is that the best approach?

 

How about inserting %variable% text into one of the fields?

 

Sorry, have not read a lot of the documentation yet...

Link to comment
Share on other sites

In Windows forms (winforms) all the things like buttons or text boxes are called "controls". Instead of tabing around, moving the mouse cursor and all that MEP can interact directly with the controls. There is an example of this in the sample file using Calculator. It's a more advanced topic but it's far more elegant. Whenever I write a macro I try to use controls first and only when I can't do I resort to mouse moves and so forth. It might be difficult to understand the benefit or distinction but it's there. For instance to fill in a text box instead of moving to it with the mouse or tabs and clicking on it and blindly typing you can simply set the control's text to whatever you like. And it doesn't matter where the control is. In fact it can even be hidden completely. EG minimize Calculator and you can still press it's buttons and read the results. I don't want to get into a lengthy 'how to' but there are two things I want to mention that often catch people out.

 

First off a control variable does not house a control. And controls have an address and each time the winform is opened it will have a different address. So the MEP control variable is more like a map or set of directions to the control. At run time MEP runs down this map to find the controls address.

 

Next take note that one of the most important control commands is hidden in the TextType dialog. Use this for putting text into a text field.

 

Finally be aware that web based apps like a Java form in a web browser have a special kind of controls and are not available to MEP.

 

Open that macro for Calculator and see how it works. Then try some time tests of your own. If you get lost post an example here but make sure to use an application like Calculator as an example. Something we all have. Happy hunting.

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