cruisepandey Posted June 19, 2020 Posted June 19, 2020 Hi, As soon as I launch VIP access application in my windows machine (By default it starts at bottom right hand side corner), I want to move it to left hand side corner by winmove function or any other function. Code I have tried without any luck : Run("VIPUIManager.exe"); $vipAccessHandle = WinActivate("VIP Access"); Local $aPos = WinGetPos($vipAccessHandle); ;ConsoleWrite($aPos[0]); WinMove($vipAccessHandle, "", 100, 100); Sleep(2000) ;WinMove($vipAccessHandle, "", $aPos[0], $aPos[1], $aPos[2], $aPos[3]); Sleep(2000); WinClose($vipAccessHandle) I am attaching a pic of it's icon
Musashi Posted June 19, 2020 Posted June 19, 2020 Try : Local $vipAccessHandle, $aPos Run("VIPUIManager.exe") $vipAccessHandle = WinWaitActive("VIP Access") WinActivate($vipAccessHandle); ConsoleWrite("Handle = " & $vipAccessHandle & @CRLF) ; *** only for test $aPos = WinGetPos($vipAccessHandle) If IsArray($aPos) Then ConsoleWrite($aPos[0] & " " & $aPos[1] & " " &$aPos[2] & " " &$aPos[3] & @CRLF) ; *** only for test WinMove($vipAccessHandle, "", 100, 100); Sleep(2000) WinMove($vipAccessHandle, "", $aPos[0], $aPos[1], $aPos[2], $aPos[3]); Sleep(2000) Else ConsoleWrite("! WinGetPos failed " & @CRLF) EndIf WinClose($vipAccessHandle) "In the beginning the Universe was created. This has made a lot of people very angry and been widely regarded as a bad move."
cruisepandey Posted June 19, 2020 Author Posted June 19, 2020 It did not throw any error, but window also did not move. thanks for reply tho
Musashi Posted June 19, 2020 Posted June 19, 2020 1 hour ago, cruisepandey said: It did not throw any error, but window also did not move. This script works with standard windows such as Notepad : ; With Notepad : Local $vipAccessHandle, $aPos Run("notepad.exe") $vipAccessHandle = WinWaitActive("[CLASS:Notepad]", "", 10) WinActivate($vipAccessHandle); ConsoleWrite("Handle = " & $vipAccessHandle & @CRLF) ; *** only for test ConsoleWrite("Title = " & WinGetTitle($vipAccessHandle) & @CRLF) ; *** only for test $aPos = WinGetPos($vipAccessHandle) If IsArray($aPos) Then ConsoleWrite($aPos[0] & " " & $aPos[1] & " " &$aPos[2] & " " &$aPos[3] & @CRLF) Sleep(2000) ; *** WinMove($vipAccessHandle, "", 100, 100, 200, 200); Sleep(2000) ; *** WinMove($vipAccessHandle, "", $aPos[0], $aPos[1], $aPos[2], $aPos[3]); Sleep(2000) ; *** Else ConsoleWrite("! WinGetPos failed " & @CRLF) EndIf In your case, we may be dealing with a GUI based on QT (QWidgets) - not really my specialty . Just a shot in the dark (very dark) : Local $vipAccessHandle, $aPos Run("VIPUIManager.exe") $vipAccessHandle = WinWaitActive("[CLASS:Qt5QWindowIcon]", "", 10) WinActivate($vipAccessHandle); ConsoleWrite("Handle = " & $vipAccessHandle & @CRLF) ; *** only for test ConsoleWrite("Title = " & WinGetTitle($vipAccessHandle) & @CRLF) ; *** only for test $aPos = WinGetPos($vipAccessHandle) If IsArray($aPos) Then ConsoleWrite($aPos[0] & " " & $aPos[1] & " " &$aPos[2] & " " &$aPos[3] & @CRLF) WinMove($vipAccessHandle, "", 100, 100); Sleep(2000) ; *** WinMove($vipAccessHandle, "", $aPos[0], $aPos[1], $aPos[2], $aPos[3]); Sleep(2000) ; *** Else ConsoleWrite("! WinGetPos failed " & @CRLF) EndIf WinClose("[CLASS:Qt5QWindowIcon]") What do the ConsoleWrites indicate? "In the beginning the Universe was created. This has made a lot of people very angry and been widely regarded as a bad move."
Earthshine Posted June 19, 2020 Posted June 19, 2020 qt can be automated with UIAutomation. My resources are limited. You must ask the right questions
cruisepandey Posted June 21, 2020 Author Posted June 21, 2020 On 6/20/2020 at 12:27 AM, Musashi said: This script works with standard windows such as Notepad : ; With Notepad : Local $vipAccessHandle, $aPos Run("notepad.exe") $vipAccessHandle = WinWaitActive("[CLASS:Notepad]", "", 10) WinActivate($vipAccessHandle); ConsoleWrite("Handle = " & $vipAccessHandle & @CRLF) ; *** only for test ConsoleWrite("Title = " & WinGetTitle($vipAccessHandle) & @CRLF) ; *** only for test $aPos = WinGetPos($vipAccessHandle) If IsArray($aPos) Then ConsoleWrite($aPos[0] & " " & $aPos[1] & " " &$aPos[2] & " " &$aPos[3] & @CRLF) Sleep(2000) ; *** WinMove($vipAccessHandle, "", 100, 100, 200, 200); Sleep(2000) ; *** WinMove($vipAccessHandle, "", $aPos[0], $aPos[1], $aPos[2], $aPos[3]); Sleep(2000) ; *** Else ConsoleWrite("! WinGetPos failed " & @CRLF) EndIf In your case, we may be dealing with a GUI based on QT (QWidgets) - not really my specialty . Just a shot in the dark (very dark) : Local $vipAccessHandle, $aPos Run("VIPUIManager.exe") $vipAccessHandle = WinWaitActive("[CLASS:Qt5QWindowIcon]", "", 10) WinActivate($vipAccessHandle); ConsoleWrite("Handle = " & $vipAccessHandle & @CRLF) ; *** only for test ConsoleWrite("Title = " & WinGetTitle($vipAccessHandle) & @CRLF) ; *** only for test $aPos = WinGetPos($vipAccessHandle) If IsArray($aPos) Then ConsoleWrite($aPos[0] & " " & $aPos[1] & " " &$aPos[2] & " " &$aPos[3] & @CRLF) WinMove($vipAccessHandle, "", 100, 100); Sleep(2000) ; *** WinMove($vipAccessHandle, "", $aPos[0], $aPos[1], $aPos[2], $aPos[3]); Sleep(2000) ; *** Else ConsoleWrite("! WinGetPos failed " & @CRLF) EndIf WinClose("[CLASS:Qt5QWindowIcon]") What do the ConsoleWrites indicate? In case of notepad, it worked successfully, I could see notepad got resized and came to it's original position. For notepad console output is : Handle = 0x00040C14 Title = Untitled - Notepad 274 282 1119 550 >Exit code: 0 Time: 7.037 But in case of VIP access, it did not do anything: Handle = 0 Title = ! WinGetPos failed >Exit code: 0 Time: 10.25
Recommended Posts
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 accountSign in
Already have an account? Sign in here.
Sign In Now