Alexis Posted November 18, 2021 Report Share Posted November 18, 2021 Hey everyone, how do I activate all opened WinExplorer Windows? Their window title have different names depending on which folder is open. I tried to activate "explorer.exe" which I thought would be the application behind the WinExplorer windows, but that doesn't work. Is that even possible? Quote Link to comment Share on other sites More sharing options...
acantor Posted November 18, 2021 Report Share Posted November 18, 2021 I don't think it's possible because of how Windows works. You can only interact with one window at a time. That window is the active window. Other windows may be visible, but they are in the background. You can't interact with a non-active window until you give it focus by clicking on it or switching to it via keyboard. It may be possible to write a macro that, when activated, brings up an instance of File Explorer. Activate the macro again, and the macro brings up another instance of File Explorer, if there is one. And so on. Quote Link to comment Share on other sites More sharing options...
Alexis Posted November 18, 2021 Author Report Share Posted November 18, 2021 So it's not possible like, having multiple Chrome windows, and making them visible via "set window order" or activating them one after another, because Chrome always has Chrome in all of it's window titles. While WinExplorer windows always have the current opened folder as window title, correct? Quote Link to comment Share on other sites More sharing options...
acantor Posted November 19, 2021 Report Share Posted November 19, 2021 Although this is not a perfect solution, this script activates each instance of File Explorer, one after another. So if you have ten windows open, and five of them are File Explorer, running the macro will place the five File Explorer windows on top of the stack. There are plenty of problems with this script: 1. The macro enumerates any window that includes "c:\" in its title bar. Therefore, the macro misidentifies all non-File Explorer windows that have "c:\" in their titles. 2. The macro misses File Explorer windows for non-c: drives, like "d:\" or "z:\". You might try to fix this by changing the target title from "c:\" to ":\" but I can imagine this might introduce all sorts of side effects. 3. The macro misses named File Explorer folders, like "This PC" and "Documents". However, I believe there is a registry hack that toggles off named folders. 4. The stop rule is ugly. If Line 5 (Window activate) fails because the window doesn't exist, the macro handles the error by bringing everything to a screeching halt. But I can live with this aesthetic blemish if others can. Hopefully someone can improve the script. Variable Set Handle %WinTitle% from all windows with the title of "C:\" Get Array Length (%WinTitle%) => %Count% Variable Set Integer %x% to 1 Repeat Start (Repeat %Count% times) Window Activate: %WinTitle[%x%]% On Error Catch Error: Window could not be found Macro Stop End Catch Error End Error Variable Modify Integer %x%: Increment End Repeat <VARIABLE SET HANDLE Option="\x00" Info="C:\\" Partial="TRUE" Wildcards="FALSE" Destination="%WinTitle%"/> <GET ARRAY LENGTH Array="%WinTitle%" Dest="%Count%"/> <VARIABLE SET INTEGER Option="\x00" Destination="%x%" Value="1"/> <REPEAT START Start="1" Step="1" Count="%Count%" Save="FALSE"/> <WINDOW ACTIVATE Title="%WinTitle[%x%]%" Exact_Match="FALSE" Wildcards="FALSE" _HANDLE="0x0006"/> <ON ERROR/> <CATCH ERROR Code="6"/> <MACRO STOP/> <END CATCH ERROR/> <END ERROR/> <VARIABLE MODIFY INTEGER Option="\x07" Destination="%x%"/> <END REPEAT/> Quote Link to comment Share on other sites More sharing options...
Alexis Posted November 19, 2021 Author Report Share Posted November 19, 2021 Thank you very much for your input. Actually it never happens that "C:"\ is in the title as the window title shows only the current folder name. I guess i have to define a handle variable for each instance of win explorer like %ex1% to %ex5% to "handle" those windows reliable. This also has the advantage that i can adress each window individually which might be useful. 😉 Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.