Andy Posted July 11, 2004 Report Share Posted July 11, 2004 I want to write 2 macros, to Hide and Show hidden folders. Or preferably one macro that would toggle the setting. Is there a way to do this more elegant than recording mouse moves and clicks? I can't seem to find "Folder Options" as a Control Panel Applet. Andy Quote Link to comment Share on other sites More sharing options...
joe Posted July 11, 2004 Report Share Posted July 11, 2004 Hello Andy! There is a Macro Express command named File Attributes (Files/Folders category) that can be used to set or reset file attributes. I thought that it worked on folders, too. And it sort of does. If you place a folder name in the Filename field (and set the Attribute choices) then any files and folders within the target folder will be set accordingly ... but not the folder name itself. An alternative is to use the Windows Run command dialog. Like this: Run Dialog Window: Run Programs Wait For Window Title: "Run" Text Type: attrib +h c:\foldera\subfolder1 Text Type: <ENTER> Wait Window Lose Focus: "Run" Macro Return The above example would set the subfolder1 folder to hidden, but leave everything else within it untouched. If you need to know how to use the DOS attrib command then do the following: Engage the windows Run dialog Type "cmd" or "command" without the quotes, then hit <Enter> From the DOS window type in "attrib /?" without the quotes, then hit <Enter> You will see the acceptable command line arguments for the DOS attrib command. To close the DOS window, just type "exit" without the quotes, then hit <Enter>. Quote Link to comment Share on other sites More sharing options...
Andy Posted July 12, 2004 Author Report Share Posted July 12, 2004 Joe, Thanks, but I didn't explain myself well. I wasn't looking for a way to change file attributes. What I want to do is toggle Windows Explorer showing or not showing hidden files, thru the Folder Options dialog box, the View tab. You can get to Folder Options either thru the Control Panel, or in an individual folder thru Tools>Folder Options (even though the View tab changes things globally). Andy Quote Link to comment Share on other sites More sharing options...
kevin Posted July 12, 2004 Report Share Posted July 12, 2004 Andy, A quick google search and experiment with Explorer and Regedit turned up the this. When the Tools | Folder Options | View | "Do not show hidden files and folders" radio button is clicked the registry value 'Hidden' in the registry key: HKEY_CURRENT_USER\Software\Microsoft\Windows\CurrentVersion\Explorer\Advanced changed from 1 to 2. Similarly when the the Tools | Folder Options | View | "Show hidden files and folders" radio button is clicked the registry value 'Hidden' changed from 2 to 1. Using this information you could write a macro that uses the 'Write Registry Integer' command to change this registry value. I did not check to see if this was the only registry value that changed so some testing and experimenting may be needed. Quote Link to comment Share on other sites More sharing options...
Andy Posted July 12, 2004 Author Report Share Posted July 12, 2004 Excellent, Kevin! I'll give it a try. Thanks, Andy Quote Link to comment Share on other sites More sharing options...
DMGberg Posted June 20, 2006 Report Share Posted June 20, 2006 I think I posted this one other time, but here's one that works good: If Not Program Name "EXCEL.EXE" running Program Launch: "EXCEL.EXE" Variable Set Integer %N1% to 1 Write Registry Integer: "" Macro Stop End If Read Registry Integer: "State" Variable Set String %T1% "Microsoft Excel" If Variable %N1% = 0 Window Show: "%T1%" Activate Window: "%T1%" Variable Modify Integer: %N1% = %N1% + 1 Write Registry Integer: "State" Else Window Hide: "%T1%" Variable Modify Integer: %N1% = %N1% + -1 Write Registry Decimal: "State" End If Registry value would be something like: HKEY_CURRENT_USER\Software\Microsoft\Office\11.0\Excel\State You could program its creation but since you only need create it once, just regedit, add value DWORD "State" or whatever you want to call it. Attach it to a hotkey. What it does: If program not running, runs it (you don't need to activate it, just have it maximized or normal) If running and visible, hides it. If running and not visible, shows it. It will not appear in the taskbar or system tray so you just have to know it's there. If you don't want it to open on top, leave out the "activate" If you're not comfortable putting something in the registry, you could do it other ways but this is completely safe in CURRENT_USER keys. I've got a bunch of these because I just don't like my taskbar cluttered with stuff I know is around. 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.