Jump to content

How to run 2 instances of Windows Explorer side by side


 Share

Recommended Posts

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
Spoiler

CDebug Dumps values of variables including arrays and DLL structs, to a GUI, to the Console, and to the Clipboard

 

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

 

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

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...