Jump to content
cruisepandey

After launching an exe file winmove is not able to move it's position.

Recommended Posts

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 

a.PNG

Share this post


Link to post
Share on other sites

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)

 


Musashi-C64.png

"In the beginning the Universe was created. This has made a lot of people very angry and been widely regarded as a bad move."

Share this post


Link to post
Share on other sites
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?

 


Musashi-C64.png

"In the beginning the Universe was created. This has made a lot of people very angry and been widely regarded as a bad move."

Share this post


Link to post
Share on other sites
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

Share this post


Link to post
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

  • Recently Browsing   0 members

    No registered users viewing this page.

×
×
  • Create New...