Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
mou to calculated coordinates - why doesn't work
#1
I often use either GetWinXY or DpiGetWindowRect to help me move the mouse cursor to the center of a window.
For some reason, I have to do it in two steps:

Code:
Copy      Help
int w=win("Untitled - Notepad" "Notepad")
int x y cx cy x_mid y_mid
GetWinXY(w x y cx cy)
int x_mid(x+(cx*0.5)) y_mid(y+(cy*0.5))
mou x_mid y_mid

or


Code:
Copy      Help
RECT r
DpiGetWindowRect w &r
x_mid = r.left+(0.5*(r.right-r.left))
y_mid = r.top+(0.5*(r.bottom-r.top))
mou x_mid y_mid


but these do not work:

Code:
Copy      Help
mou x+(cx*0.5) y+(cy*0.5)
mou r.left+(0.5*(r.right-r.left)) r.top+(0.5*(r.bottom-r.top))

just wondering why. Not a big deal but I want to make sure I understand if this is my misunderstanding of QM's syntax for functions/commands.

Thanks as always,
S
#2
Does not work because the expression is of type double, because contains values of type double. QM mouse commands interpret it as part of window or screen.

Examples:
mou 100 100 ;;100 100 pixels
mou 0.5 0.5 ;;screen center
mou 100 0.5 ;;100 pixels horizontally, center vertically
#3
thanks! I am mad that I didn't figure this out myself! :oops:
S


Forum Jump:


Users browsing this thread: 1 Guest(s)