Sign in to follow this  
Followers 0
mercadantelaura

Window Personal Size & Position

3 posts in this topic

#1 ·  Posted (edited)

I'm using Win7 64 bits.
I have coded a small script utility that i have added to my explorer toolbar in order to obtain immediately (when i click icon) window dimension and position to value that i have setted into script.
Unfortunately i have 2 problems:

(1st)

If the dimension of Left/Right Panel is changed and not equal to value that i want,
in order to obtain the dimension that i want of Left Panel "SysTreeView321" and Right Panel "DirectUIHWND3" i'm using function "MouseClickDrag" to Move sepration column that change dimension of this 2 controls.
Unfortunately this method is not immediately (as for only WinMove) and in addiction
if i move mouse before that script has finished its work, the dimension of 2 controls
is not restored to my configuration but setted to mouse position.

(2nd)

If i restore personal dimension and i open new session of explorer.exe it will be opened
with old wrong dimension and i need to click again toolbar icon to re-set custom config.
To take effect also for New session of explorer i must manually change dimension of window
moving window border with mouse because the new dimension setted using "WinMove" is not stored from windows.  Why ?


There is some better solution ?
Thanks

This is my code:

 

#NoTrayIcon
Local $hWindow = WinGetHandle( "[CLASS:CabinetWClass]" )
    If Not $hWindow Then EXIT

    
Local $FromLeft = 37
Local $FromTop = 20
Local $Width = 950
Local $Height = 650

Local $Separation = 346




    
WinMove( $hWindow, "", $FromLeft, $FromTop, $Width, $Height)

Local $MousePos = MouseGetPos()
Local $ControlLeftPos = ControlGetPos ( $hWindow, "", "SysTreeView321" )
Local $ControlRightPos = ControlGetPos ( $hWindow, "", "DirectUIHWND3" )


Do
    Sleep(5)
    Local $WinPos = WinGetPos( $hWindow )
Until $WinPos[0] = $FromLeft


Local $Border_vSize = 150
Local $Border_hSize = ( $WinPos[2] - $ControlLeftPos[2] - $ControlRightPos[2] ) / 3

Local $SeparationColumn = $WinPos[0] + $ControlLeftPos[2] + $Border_hSize * 1.5


If $SeparationColumn <> $Separation Then MouseClickDrag ("Left",  $SeparationColumn,  $WinPos[1] +$Border_vSize,  $Separation,  $WinPos[1] +$Border_vSize,   0)


MouseMove($MousePos[0], $MousePos[1], 0) ;  Return to previously Mouse Position
Edited by mercadantelaura

Share this post


Link to post
Share on other sites



Nobody can give me council for better solution to solve the 2 problems using my script ?

Share this post


Link to post
Share on other sites

Someone know a method to store new dimension and position of active wiNdow setted using function "WinMove"
in order to obtain same dimension and position of new window opening new session of window explorer ?

Thanks all member that can give me help

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
Sign in to follow this  
Followers 0