Jump to content
Macro Express Forums

Fp: Relative Mouse Location


cuppanews
 Share

Recommended Posts

I'm just learning about postioning the mouse relative to a control. In doing so, I thought of what I think could be a useful enhancement to the Mouse Location tool.

 

Is there a convenient way of measuring the X and Y offsets from the upper left corner of a control? For instance, if you want to place the cursor in a web form field, how do you calculate the number of pixels to move the mouse relative to the control? Right now, I think all you can do is note the location of the upper left corner using the Mouse Location tool, write this down. Do the same for the new X-Y position. Then subtract the latter from the former.

 

What if you could point to the upper left corner, click and then drag the mouse pointer to the new X-Y position? I'm imagining that as soon as you pressed down on the mouse button, the displayed coordinates would go to zero and then start measuring the distance in pixels until you released the button.

 

What do you think?

Link to comment
Share on other sites

Hello cuppanews!

 

I know you are referring to the Mouse Move command, however, if you are wanting to calculate coordinates for the purpose of knowing where to click on a control, you made not need to take the steps you mentioned. There is a convenient feature built in to the Mouse Click on Control command (Advanced tab) that allows you to offset the click either to the center of the control or at some other set of coordinates relative to it.

 

You could also force the macro to do its own calculations using the Set Integer to Control Left, Top, Width, and Height commands. Or you could create a utility macro of your own to take the steps that you are looking for.

 

Either way it sounds like a nice suggestion and you can easily submit it to Insight using "Options | Configure Bug Reporter | Request a Feature" within the Macro Express Explorer window.

Link to comment
Share on other sites

  • 3 weeks later...

Actually, I'm not quite there yet... ;-)

 

When I use Mouse Click on Control and then specify X/Y coordinates under the Advanced tab, it's not moving the mouse to those coordinates. (The next command is Type Text, and it's doing so wherever the mouse pointer happens to be.)

 

The control I'm using is the top-level browser window -- i.e., I run the Get Control utility,move the mouse pointer up to the window's top border, and then call that C1. Then I use the X/Y coordinates relative to that control's upper-left corner. Am I doing that correctly?

 

On the other hand, this works...

 

Mouse Move Relative to Control %C1%: 98, 352

Mouse Left Button Click

Text Type: %T1%

 

I'd rather do the first two commands in a single command (Mouse Click on Control) if I can, and I thought that what you were suggesting would let me do that.

 

Cheers.

 

M.

Link to comment
Share on other sites

When you do a Mouse Click on a Control, the mouse does not actually move. When you manually click the mouse, a Windows message is generated and sent to the control (or program) under the mouse. The Mouse Click on Control sends the message without moving the mouse.

 

This allows for some very interesting macros. You can click buttons that are not visible and ... the mouse doesn't move.

Link to comment
Share on other sites

When you do a Mouse Click on a Control, the mouse does not actually move. When you manually click the mouse, a Windows message is generated and sent to the control (or program) under the mouse. The Mouse Click on Control sends the message without moving the mouse.

 

Ah, OK. I understand now.

 

Thanks, Kevin.

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