Dual-pane Explorer

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

  1. freddie-o

    freddie-o MDL Addicted

    Jul 29, 2009
    948
    1,233
    30
    #1 freddie-o, Sep 17, 2019
    Last edited: Aug 6, 2021
    About:
    • These AutoIt scripts open 2 instances of Explorer and "shows windows side by side".
    • When multitasking in Windows, it is more convenient using a dual-pane Explorer.



    Download:

    AutoIt (To convert the 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. This script opens 2 Explorer windows at the root of the hard 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. This script opens 2 Explorer windows at the drive or folder that is specified in "Local $Path1" & "Local $Path2" and "shows windows side by side"
    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