Question

WinGetPos,X,Y,W,H,A

space::MsgBox,%H%,%W%,%X%,%Y%

When this runs I get X and y to be 0 and I get the hidth and width to be the resolution to my screen I imagine something is happening where my desktop is being selected before this is run but I'm pretty confused as to where that is.

Was it helpful?

Solution

Are you perhaps launching this script by double-clicking an icon on the desktop, or from a full-screen window?

The WinGetPos command will run as soon as the script is launched. Only the message box will run when you press space, but will always return those same initial values no matter what window you are in at the time.

Change it to this and you should get the expected results:

space::
    WinGetPos,X,Y,W,H,A
    MsgBox,%H%,%W%,%X%,%Y%
    return
Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top