Jump to content
Macro Express Forums

Center Mouse Cursor To Screen / Window...


Recommended Posts

but problem with that is then the macro doesn't center for ANY screen resolution. it only works for one...
It works for whatever screen resolution or window size is in effect when the macro runs.

 

I am curious why you need to move the mouse to the center of the screen. Could you explain?

Link to post
Share on other sites
  • 2 weeks later...

it may work for moving the mouse for various resolutions but it will not always be centered for every resolution because the coordinates are different for each resolution.

 

i use center mouse cursor for certain windowed programs that dont remember their window position. so i make a macro that centers the window and then centers the cursor. i find this convenient since it saves me some mouse movment because I use high resolution desktop on my monitor. and i want this macro to work center properly for any resolution i use.

Link to post
Share on other sites
it may work for moving the mouse for various resolutions but it will not always be centered for every resolution because the coordinates are different for each resolution.
Your macro can obtain the resolution of the screen and the size of a window. Combine that with a couple of div or mult commands and you can calculate the center. See the following commands:
Variable Set Integer %N1% from Top of Window
Variable Set Integer %N2% from Left of Window
Variable Set Integer %N3% from Width of Window
Variable Set Integer %N4% from Height of Window

Variable Set Integer %N5% from Screen Width
Variable Set Integer %N6% from Screen Height

Variable Modify Integer: %N1% = %N1% * %N2%
Variable Modify Integer: %N1% = %N1% / %N2%

Link to post
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...