Dual-pane Explorer

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

  1. freddie-o

    freddie-o MDL Senior Member

    Jul 29, 2009
    474
    465
    10
    #1 freddie-o, Sep 17, 2019
    Last edited: Oct 12, 2019
    Introduction:
    These AutoIt scripts automate running 2 instances of Windows Explorer and arranges them side by side.



    About the script:
    I am not the original author of this script. I just discovered it and slightly tweaked it.
    (Please don't ask me about AutoIt scripting as I understand very little. I just did some googling and testing.)




    Reason:
    It's more convenient to multitask with a dual-pane File Manager.
    I tried almost every dual-pane File Manager I could find -- but I still prefer Windows Explorer to do tasks in Windows.
    Prior to this I just open 2 instances of Windows Explorer then snap them side by side.





    Download AutoIt:

    AutoIt




    How To:
    1. Install AutoIt (or extract if you downloaded the portable zip version.)
    2. Open SciTE Script 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 default Explorer windows
    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 to a specified drive, partition and/or folder.
    Change the path location (Local $Path1)
    Code:
    Local $Path1 = "G:\"
    Local $hRun1 = _Run("explorer /e, " & '"' & $Path1 & '"', 0, 0, @DesktopWidth/2, @DesktopHeight - 40)
    Local $Path2 = "H:\"
    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