Jump to content
Macro Express Forums

Universal Macros


MrBiggz
 Share

Recommended Posts

I'm new to using ME, and love it!! But have run into a snag. I'm trying to create a set of macro's for a group of people who basically do the same tasks day in day out. The problem I'm running into is that I'm trying to get control of entering data into a window that has no "Windows Controls", so no File/Edit/View/etc...drop down menu's from the top of the window, just built in Icon's in the app. In order to get to that Icon I've tried using mouse location, but because of monitor size and screen resolution differences, the location is on each of the desktop's, it puts the mouse on different locations for different people. End result is it either clicks on something it's not supposed to or nothing at all.

 

So I guess my question is can I tell it to find an Icon in the window and then click on it?

Link to comment
Share on other sites

Are you moving the mouse relative to the screen, or relative to the application window? I have found that window-relative works reliably for me at different resolutions, whereas screen-relative does not -- though I don't really understand why.

 

Other than that, there is a Get Control command, followed by the Mouse Click on Control command, that might work. There's a little tutorial within the Help screens that leads you through the process using the Windows Calculator application as an example. It's laborious to set up because you have to do each icon separately in your macro, using the Get Control Utility. I am told it works well for some applications but not for others.

 

I believe that, if Get Control works for you, you can then get the text associated with the control. That might be useful to assure that you are really pointing to the correct icon before you click on it.

Link to comment
Share on other sites

If the button isn't a control I would try looking for a hotkey or tabbing to the button. But sometimes with things like ActiveX or Java in a web browser that's not an option. For that I usually contrive various means of getting around this. Easiest is when it first runs ask the user to position the mouse over the button and save the position to the registry or an INI file. Then use that from now on as the location. This makes it per user. The other trick is to get the pixel color at that position. Usually the button is a different color or at least you can find one unique color in there. If the color doesn't match prompt the user to point you to the correct place and then use my first trick to store it. In the worse case where the buttons move I search the entire screen for a pattern of pixel colors to find the button. Or if the cursor changes when hovering move the mouse around until the icon changes and click. This works well for edge detect as well.

Link to comment
Share on other sites

Are you moving the mouse relative to the screen, or relative to the application window? I have found that window-relative works reliably for me at different resolutions, whereas screen-relative does not -- though I don't really understand why.

 

Other than that, there is a Get Control command, followed by the Mouse Click on Control command, that might work. There's a little tutorial within the Help screens that leads you through the process using the Windows Calculator application as an example. It's laborious to set up because you have to do each icon separately in your macro, using the Get Control Utility. I am told it works well for some applications but not for others.

 

I believe that, if Get Control works for you, you can then get the text associated with the control. That might be useful to assure that you are really pointing to the correct icon before you click on it.

 

Unfortunately the Windows Controls aren't programmed correctly into the App. When I try the "Get Control" and "Click on Control", there is a click, I can see it, but nothing happens. So I have to use the "Mouse left click" command, and that works.

 

Using the relative to window or screen is where I'm having problems. I've tried both and neither work.

 

Is there a way to say "IF Screen resolution is XYZ", then use these mouse positions, IF Screen resolution is ABC, then use these positions". Not sure if I'm explaining that right, but I hope you get the point! :)

Link to comment
Share on other sites

Ok I've found that, read the help section, and please forgive my ignorance, but I'm kind of getting it, but not really! lol

 

So I have this window, and in it there is a "Save" icon I want to get to. What I'd like for the macro to do is first determine the resolution of the screen, and then to be able to know which mouse movements to make (because "Click on Control" doesn't work) based on their screen resolution.

 

Or maybe this is a better way to do it. Based on the window size, move to X and Y location from left edge of current window. Now regardless of screen size, the distance from the left or right edge of that window to that icon "should" be the same, right?! Maybe this would work better?

 

So I'm not sure which commands to use. The "Set Value from Current window top" or "Set Value from Screen Width/Height" commands to get what I need.

Link to comment
Share on other sites

I think basing the mouse position on the window size is your best bet. If the window opens in different sizes, you can use the Window Resize command to standardize the dimensions each time the macro is run.

 

To click on the button, use the Mouse Move command. Open the Mouse Locator to help you find the X and Y coordinates. Set the movement to Relative to Window. After moving the mouse, use the Left Button Click option to click on the coordinates defined.

Link to comment
Share on other sites

I had this problem too, people using different screen resolutions and an application that dynamically positioned buttons at the bottom of the screen.

 

The solution is pretty simple:

 

Variable Set Integer %N11% from Screen Height

Variable Modify Integer: %N12% = %N11% - 122

Mouse Move Screen 35, %N12%

Mouse Left Button Click

 

The first line puts the screen height into N11

 

The second function deletes from N11 what the static distance from the bottom of the screen to where the button you want to click is and puts the result into N12. (You will have to figure out what it is on your interface since it won't be 122)

 

The third line moves the mouse to a static distance from the left hand of the screen to the vertical coordinate you just put in N12.

Link to comment
Share on other sites

  • 2 weeks later...

Thank you all for your replies.

 

Rustywinger - I tried your suggestion, still doesn't work! :( I even went one step further and tried Variable Set Integer %N11% from Screen Height and Variable Set Integer %N11% from Screen Width to map X/Y coordinates based on Window size, but still no luck. I think I'm heading down the right path however. Since the Icon is in the upper right hand corner, I'm going to try to use that as my starting point with the mouse, and come down and left to the icon.

Link to comment
Share on other sites

You may want to consider calculating the button position by using percentages. Get the screen and application height/width of the most popular resolution. Then get the button XY position and divide those numbers by the window height and width. For example, the window is 400 pixels tall, the button is 300 pixels down. Then use a calculated Y coordinate for all the screen resolutions. Y = Window height * 3 and then Y = Y / 4. (Kind of cryptic, but I hope you get the idea.)

iceman

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

×
×
  • Create New...