Jump to content
Macro Express Forums

Moving the mouse pointer to the upper right corner of a window


Recommended Posts

I am having a problem with a simple script that moves the mouse cursor to the upper right corner of the current window: 

Variable Set Integer %x%: Set to the Current Window's Width
Variable Set Integer %y%: Set to the Current Window's Top
Mouse Move: %x%, %y% Relative to Current Window
Mouse Move: -10, 10 Relative to Last Position // Nudge the mouse pointer a little so that it is visible in maximized windows

 

<VARIABLE SET INTEGER Option="\x0A" Destination="%x%"/>
<VARIABLE SET INTEGER Option="\x08" Destination="%y%"/>
<MOUSE MOVE Option="\x02" X="%x%" Y="%y%" _PROMPT="0x000A"/>
<MOUSE MOVE Option="\x03" X="-10" Y="10" _PROMPT="0x000A" _COMMENT="Nudge the mouse pointer a little so that it is visible in maximized windows"/>

 

The script works in maximized windows, and also in windows that are clinging to the top of the screen.

 

In other situations, for example, if I resize the window so that it is centred in the middle of the screen, the mouse cursor is correct for the x coordinate, but not the y coordinate. The error seems to be proportional, or at least related, to the distance of the top of window from the top of the screen.

 

Can anyone confirm this behaviour? Or is there a flaw in my script?

 

Link to comment
Share on other sites

Alan,

 

I got same behaviour on the couple of tests I had time for (Firefox and a folder). Strange. Speculative, but may be related to the other mouse cursor issue we were discussing?

 

--------------------

EDIT at 08:40

Scrub that speculation! It's because the macro logic is wrong! The following does the job:

 

Variable Set Integer %x%: Set to the Current Window's Width
Mouse Move: %x%, 0 Relative to Current Window
Mouse Move: -10, 10 Relative to Last Position // Nudge the mouse pointer a little so that it is visible in maximized windows


<VARIABLE SET INTEGER Option="\x0A" Destination="%x%"/>
<MOUSE MOVE Option="\x02" X="%x%" Y="0" _PROMPT="0x000A"/>
<MOUSE MOVE Option="\x03" X="-10" Y="10" _PROMPT="0x000A" _COMMENT="Nudge the mouse pointer a little so that it is visible in maximized windows"/>

 

  • Thanks 1
Link to comment
Share on other sites

I have a similar macro, but it does only a single mouse move instead of two.
That is, calculate the intended mouse destination BEFORE moving.  I wonder if
moving to the extreme limit of the window, rather than safely within the limits,
might sometimes be a problem.  

  // .... click on X at upper right of window
  Variable Set Integer %N30% from Width of Window
  Variable Modify Integer: %N30% = %N30% - 14
  Mouse Move Window %N30%, 9
  Mouse Left Button Click

 

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