c.haslam

How to run 2 instances of Windows Explorer side by side

3 posts in this topic

#1 ·  Posted (edited)

I would like to automate placing one instance of Windows Explorer in the left hald of my screen and another in the right half.

The following code is creating the left instance OK, but not the right:

Opt('TrayIconDebug',1)
Send('#e')          ; run Win Explorer
WinWaitActive('Computer')
Send('#{UP}')       ; Maximize window
Send('#{LEFT}')     ; To left half of screen
Sleep(500)
Send('#E')          ; run Win Explorer
Local $wh2 = WinWaitActive("[TITLE:Computer; CLASS:CabinetWClass; INSTANCE:2]", "")
ControlSend($wh2,'',0,'#{UP}')      ; Maximize window
Send('#{RIGHT}')    ; To right half of screen

This is my latest attempt.

...chris

 

Edited by c.haslam

...chris

Share this post


Link to post
Share on other sites



You can try something like the following:

All credit to Melba23

Local $hRun1 = _Run('Explorer.exe', 0, 0, @DesktopWidth/2, @DesktopHeight - 50)
Local $hRun2 = _Run('Explorer.exe', @DesktopWidth/2, 0, @DesktopWidth/2, @DesktopHeight - 50)

Func _Run($sRunCommand, $iX, $iY, $iW, $iH)
    Local $aWinList_Before = WinList("[CLASS:CabinetWClass]")
    Run($sRunCommand)
    Do
        $aWinList_After = WinList("[CLASS:CabinetWClass]")
    Until $aWinList_After[0][0] > $aWinList_Before[0][0]
    Local $hWnd = $aWinList_After[1][1]
    Sleep(1000)
    WinMove($hWnd, "", $iX, $iY, $iW, $iH)
EndFunc

 

Share this post


Link to post
Share on other sites

Thank you, Subz. And thanks also to Melba23.

 


...chris

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