Dual-pane Explorer

Discussion in 'Scripting' started by freddie-o, Sep 17, 2019.

  1. freddie-o

    freddie-o MDL Addicted

    Jul 29, 2009
    655
    734
    30
    #1 freddie-o, Sep 17, 2019
    Last edited: Nov 23, 2020 at 15:09
    About:
    • This AutoIt script automates opening 2 instances of Explorer and "show windows side by side".
    • When multitasking in Windows Explorer, it is more convenient using dual-panes.



    Download:

    AutoIt (To convert AU3 scripts to EXE and run it)




    How To:
    1. Install AutoIt (or extract if you downloaded the portable zip version.)
    2. Open SciTE Script Editor (or any source code editor)
    3. Copy and paste a script below
    4. Save as “Dual-pane Explorer.au3” (or whatever name you choose, as long as the extension is "au3")
    5. You can test “Run Script” using AutoIt3
    6. “Compile Script to .exe” using Aut2exe (Have an icon ready for your exe.)



    Scripts:

    1. Opens 2 Explorer windows at the root of the drive and "shows windows side by side"
    Code:
    Local $hRun1 = _Run('Explorer.exe', 0, 0, @DesktopWidth/2, @DesktopHeight - 40)
    Local $hRun2 = _Run('Explorer.exe', @DesktopWidth/2, 0, @DesktopWidth/2, @DesktopHeight - 40)
    
    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
    
    


    2. Opens 2 Explorer windows at the drive or folder of your choice and "shows windows side by side"
    Edit [Local $Path1] to your chosen location

    Code:
    Local $Path1 = "D:\"
    Local $hRun1 = _Run("explorer /e, " & '"' & $Path1 & '"', 0, 0, @DesktopWidth/2, @DesktopHeight - 40)
    Local $Path2 = "F:\"
    Local $hRun2 = _Run("explorer /e, " & '"' & $Path2 & '"', @DesktopWidth/2, 0, @DesktopWidth/2, @DesktopHeight - 40)
    
    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