Jump to content

Autoit Window Position


Recommended Posts

I want to get the window coordinates of the command line window I tried following but it cannot acces the variable $aPos...
 

Local $sCommandlinePath = "C:\Windows\system32\cmd.exe"
RunCm()

Func RunCm()
   RunWait($sCommandlinePath)
   ; Retrieve the position as well as height and width of the active window.
   Local $aPos = WinGetPos("[CLASS:ConsoleWindowClass]")

   ; Display the array values returned by WinGetPos.
   MsgBox($MB_SYSTEMMODAL, "", "X-Pos: " & $aPos[0] & @CRLF & _
         "Y-Pos: " & $aPos[1] & @CRLF & _
         "Width: " & $aPos[2] & @CRLF & _
         "Height: " & $aPos[3])
EndFunc

While 1
   Sleep(1000)
   RunCm()
WEnd

 

Link to comment
Share on other sites

  • Moderators

You call the console window with RunWait, which means the script is going to wait until that window disappears. If you change it to Run and add a sleep to give the window time to appear, it should work just fine.

Edited by JLogan3o13

"Profanity is the last vestige of the feeble mind. For the man who cannot express himself forcibly through intellect must do so through shock and awe" - Spencer W. Kimball

How to get your question answered on this forum!

Link to comment
Share on other sites

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
 Share

×
×
  • Create New...