terrypin Posted April 16, 2009 Report Share Posted April 16, 2009 This has been vexing me for ages, so I'd appreciate it if someone can see why it's not working please. You may remember I recently posed the problem of how to restore a set of Explorer/My Computer folders from a 'grouped' taskbar entry (because Windows surprisingly lacks such a facility). I subsequently wrote the following macro that should do it IMO. But it produces erratic results. Sometimes only a few of the windows open and the macro continues running. Sometimes the macro finishes but there's just one of many windows not opened. In case it's not clear, the macro opens all visible windows one by one, tests to see if the title matches the criteria for an Explorer folder (but excludes my text editor window, which would also qualify otherwise), then activates that window. // Assumes titles show full path Repeat with Windows: Visible Windows: Store in variable CurrentWindow // Activate only Explorer folders, which can be identified by containing the string ':\' If Variable %CurrentWindow% Contains ":\" // An Explorer window (assuming title shows full path) And If Variable %CurrentWindow% Does not Contain "Latest - TextPad" // This ensures that my text editor does not get included, despite having a title like 'Latest - TextPad - [C:\Docs\SUNDRY\Desktop Layouts\Test .txt]' Window Activate: %CurrentWindow% Wait for Window Title: %CurrentWindow% End If Delay: 200 milliseconds End Repeat CODE <COMMENT Value="Assumes titles show full path"/> <REPEAT WITH WINDOWS ToRetrieve="\x01" SortOrder="\x00" Destination="CurrentWindow"/> <COMMENT Value="Activate only Explorer folders, which can be identified by containing the string ':\\'"/> <IF VARIABLE Variable="%CurrentWindow%" Condition="\x06" Value=":\\" IgnoreCase="FALSE" _COMMENT="An Explorer window (assuming title shows full path)"/> <AND/> <IF VARIABLE Variable="%CurrentWindow%" Condition="\x07" Value="Latest - TextPad" IgnoreCase="FALSE" _COMMENT="This ensures that my text editor does not get included, despite having a title like\r\n'Latest - TextPad - [C:\\Docs\\SUNDRY\\Desktop Layouts\\Test .txt]'"/> <WINDOW ACTIVATE Title="%CurrentWindow%" Exact_Match="FALSE" Wildcards="FALSE"/> <WAIT FOR WINDOW TITLE Title="%CurrentWindow%" Partial="FALSE" Wildcards="FALSE" Indefinite="TRUE" Hours="0" Minutes="0" Seconds="0"/> <END IF/> <DELAY Flags="\x02" Time="200"/> <END REPEAT/> To test it I just open a set of 8-10 My Computer folders (with full paths shown in titles), arrange them to suit me, minimise some of them, hide others (e.g. with my browser), and then run the macro. I want and expect all folders to appear just as they did originally, with none hidden. But I'm darned if I can do it. Replacing the Wait with a Delay doesn't seem to help, nor does adding extra delays. Hope someone here can spot the flaw! -- Terry, East Grinstead, UK Quote Link to comment Share on other sites More sharing options...
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.