c.haslam Posted February 5, 2017 Share Posted February 5, 2017 (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 February 5, 2017 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 More sharing options...
Subz Posted February 5, 2017 Share Posted February 5, 2017 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 More sharing options...
c.haslam Posted February 5, 2017 Author Share Posted February 5, 2017 Thank you, Subz. And thanks also to Melba23. 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 More sharing options...
Recommended Posts
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 accountSign in
Already have an account? Sign in here.
Sign In Now