Jump to content

Recommended Posts

Posted (edited)

Hey
Why does Windows 10 "AutoIt Window Info" give the wrong window position?

WinMove() moves the window to a different point than parameters? -look script

position.jpg.2ad436cb4ac7c09a7aaa07e76cde5ef3.jpg

The test script moves the notepad.exe window to 0, 0, the real window coordinates are 8, 0

Modified script add WinGetPos() and MouseMove() and MouseGetPos()

#include <ScreenCapture.au3>
Local $iPID = Run("notepad.exe", "")
WinWait("[CLASS:Notepad]", "", 10); Wait 10 seconds for the Notepad window to appear.
WinMove ("[CLASS:Notepad]", "", 0, 0, 600, 400)
WinActivate("[CLASS:Notepad]")
Send("WinMove ('[CLASS:Notepad]', "", 0, 0, 600, 400){ENTER}")
Send("@DesktopWidth: " & @DesktopWidth & "{ENTER}")
Send("@DesktopHeight: " & @DesktopHeight & "{ENTER}")
Send("@DesktopDepth: " & @DesktopDepth & "{ENTER}")
Send("@OSArch: " & @OSArch & "{ENTER}")
Send("@OSBuild: " & @OSBuild & "{ENTER}")
Send("@OSServicePack: " & @OSServicePack & "{ENTER}")
Send("@OSType: " & @OSType & "{ENTER}")
Send("@OSVersion: " & @OSVersion & "{ENTER}")
Send(WinGetPos("[CLASS:Notepad]") & "{ENTER}")
Send("X: " & WinGetPos("[CLASS:Notepad]")[0] & "{ENTER}")
Send("Y: " & WinGetPos("[CLASS:Notepad]")[1] & "{ENTER}")
Send("Width: " & WinGetPos("[CLASS:Notepad]")[2] & "{ENTER}")
Send("Height: " & WinGetPos("[CLASS:Notepad]")[3] & "{ENTER}")
MouseMove(0,400)
Send("MouseMove(0,400){ENTER}")
Send("MouseGetPos() X: " & MouseGetPos()[0] & "Y: " & MouseGetPos()[1])
Sleep(100)
_ScreenCapture_Capture('C:\temp\screen.bmp',0,0,800,600)
MsgBox(0,"Info","Save screen to C:\temp\screen.bmp" & @CRLF & "Click OK to view the bitmap")
Run("explorer.exe C:\temp\screen.bmp")

Is ALWAYS such a difference 8px (in every Windows 7, 8, Server)?

Edited by Viszna
Posted

Can you show the output of wingetpos?

 

  Reveal hidden contents

IUIAutomation - Topic with framework and examples

Au3Record.exe

Posted

I modified the script in 1 post
I added  WinGetPos() and MouseMove() and MouseGetPos()

Result WinGetPos is X=0 and Y=0 is like in WinMove(0,0,600,400)

Looking screen: MouseMove(0,400) moving mouse cursor totally left desktop
position1.jpg.8e5c1d08dd4d8021228302c5d9eb180e.jpg

What system Windows do you have?
Can you check the script?
What's the result?

Posted (edited)

I got W10

I was able to confirm your result.

Got a space to the left just like you did, and when i dragged the window to the left and it automatically "hugged" the side, the coordinates show -7 and for firefox it's -5.

Kind of weird.

Capture.PNG

PS: There's also a gap to the right, if you set the coordinates to the far right like this

WinMove ("[CLASS:Notepad]", "", @DesktopWidth-600, 0, 600, 400)

Edited by careca
  Reveal hidden contents

IUIAutomation - Topic with framework and examples

Au3Record.exe

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
×
×
  • Create New...