Jump to content

Sky Slate Blueberry Blackcurrant Watermelon Strawberry Orange Banana Apple Emerald Chocolate
Photo

Toggle Hidden Files


  • Please log in to reply
38 replies to this topic
thinkstorm
  • Members
  • 40 posts
  • Last active: Sep 10 2014 06:06 PM
  • Joined: 17 Aug 2004
Hi,
in order to make this work, you first have to go to Windows Explorer and clear the checkbox in 'Tools->Folder Options->View->Advanced Settings' which states 'Hide protected operating system files', so all files would be displayed if you toggle 'hidden files'.
You might have to run the script two times if you start it the first time to get the variable set right....
showHidden=0

#H::
	WinGetActiveTitle, WinTitle
	WinGetClass, WinClass, %WinTitle%
	If WinClass <> CabinetWClass
		If WinClass <> ExploreWClass
			Return
	Send, !T
	Sleep, 100
	Send, o
	WinWaitActive, Folder Options,,5
	if ErrorLevel = 1
		Return
	Send, ^{Tab}
	Sleep, 50
	Send, {Tab}{Tab}
	Sleep, 50
	If showHidden  = 0
	{
		showHidden = 1
		Send, {Down}{Down}{Down}{Down}{Down}{Down}{Down}{Down}{Down}{Down}
	}
	Else
	{
		showHidden = 0
		Send, {Down}{Down}{Down}{Down}{Down}{Down}{Down}{Down}{Down}
	}
	sleep, 50
	Send, {Space}
	Send, {Tab}{Tab}{Enter}
Return

Cheers, Thorsten

Chris
  • Administrators
  • 10727 posts
  • Last active:
  • Joined: 02 Mar 2004
Thanks for posting it. By the way, you can replace things like "{Down}...{Down}" with "{Down 10}" if you prefer.

compuboy_r
  • Members
  • 68 posts
  • Last active: Oct 29 2005 03:17 PM
  • Joined: 04 May 2004
Try this one it does not even need the Explorer Window


^!h:: ;show hidden and system files

	run, c:\windows\system32\rundll32.exe c:\windows\system32\shell32.dll`,Options_RunDLL 0,,
	WinWait,Folder Options
	IfWinNotActive,Folder Options,,WinActivate,Folder Options,
	WinWaitActive,Folder Options,
	Send,^{Tab}{Tab}{Down}{Down}{Down}{Down}{Down}{Down}{Down}{Down}{Down}{Down}{Space}{Down}{Down}{Space}
	winwait,Warning
	send,{RIGHT}{SPACE}
	IfWinNotActive,Folder Options,,WinActivate,Folder Options,
	WinWaitActive,Folder Options,
	send,{Tab}{Tab}{Space}
return





^!+h:: ; hide hidden and system files

	run, c:\windows\system32\rundll32.exe c:\windows\system32\shell32.dll`,Options_RunDLL 0,,
	WinWait,Folder Options
	IfWinNotActive,Folder Options,,WinActivate,Folder Options,
	WinWaitActive,Folder Options,
	Send,^{Tab}{Tab}{Down}{Down}{Down}{Down}{Down}{Down}{Down}{Down}{Down}{Space}{Down}{Down}{Down}{Space}{Tab}{Tab}{Space}
return

Posted Image

Calabaza
  • Members
  • 9 posts
  • Last active: Mar 02 2006 07:21 PM
  • Joined: 24 Dec 2005
Is there any way of doing using the registry or it is not advisable???

Maybe something like
if ShowHidden = 2 { RegWrite ...} // turn value to 1
else RegWrite... // turn value to 2

where Showhidden is
RegRead, Showhidden, HKEY_CURRENT_USER\Software\Microsoft\Windows\CurrentVersion\Explorer\Advanced, Hidden

i think this should work, haven't tried it yet.

#n::
RegRead, ValorHidden, HKEY_CURRENT_USER, Software\Microsoft\Windows\CurrentVersion\Explorer\Advanced, Hidden
if ValorHidden = 2
  RegWrite, REG_DWORD, HKEY_CURRENT_USER, Software\Microsoft\Windows\CurrentVersion\Explorer\Advanced, Hidden, 1
else
  RegWrite, REG_DWORD, HKEY_CURRENT_USER, Software\Microsoft\Windows\CurrentVersion\Explorer\Advanced, Hidden, 2
return

Using the fact that:
User Key: [HKEY_CURRENT_USER\Software\Microsoft\Windows\CurrentVersion\Explorer\Advanced]
Value Name: Hidden
Data Type: REG_DWORD (DWORD Value)
Value Data: (1 = show hidden, 2 = do not show)

TheNewOne
  • Members
  • 2 posts
  • Last active: Mar 21 2009 09:06 PM
  • Joined: 21 Dec 2005
this works for me, if Explorer is open:

^!h:: 
    RegRead, ValorHidden, HKEY_CURRENT_USER, Software\Microsoft\Windows\CurrentVersion\Explorer\Advanced, Hidden 
    if ValorHidden = 2 
      RegWrite, REG_DWORD, HKEY_CURRENT_USER, Software\Microsoft\Windows\CurrentVersion\Explorer\Advanced, Hidden, 1 
    else 
      RegWrite, REG_DWORD, HKEY_CURRENT_USER, Software\Microsoft\Windows\CurrentVersion\Explorer\Advanced, Hidden, 2 

    WinActivate, ahk_class ExploreWClass
    Send, !xo
    Sleep, 300
    Send, ^{TAB}
    Sleep, 300
    ControlClick, Button17, ahk_class #32770
    Sleep, 300
    Send, {F5}
return


Calabaza
  • Members
  • 9 posts
  • Last active: Mar 02 2006 07:21 PM
  • Joined: 24 Dec 2005
Well, the problem is obviously about refreshing the registry.
Is there any better way of doing it?

Would be very useful for any script wich works with it...

EnvUpdate
Refreshes the OS environment. Similar effect as logging off and then on again.
Is too much, isn't?

Or

ControlSend, ToolbarWindow321, {F5}, Program Manager
Something like that but sending the F5 to the regedit,

Maybe it should be asked as a new feature if it is not already available.

not-logged-in-daonlyfreez
  • Guests
  • Last active:
  • Joined: --
This is a repeated 'issue'... How to notify the system of a Registry change, or other changes (like Desktop icon position, or Wallpaper change etcet.)...

I tried to PostMessage all kinds of values, but none works.

DLLCall/WinAPI gurus?

Calabaza
  • Members
  • 9 posts
  • Last active: Mar 02 2006 07:21 PM
  • Joined: 24 Dec 2005
Whenever i run this code, it actually does its job, it changes the values
#h::
RegRead, ValorHidden, HKEY_CURRENT_USER, Software\Microsoft\Windows\CurrentVersion\Explorer\Advanced, Hidden
if ValorHidden = 2
  RegWrite, REG_DWORD, HKEY_CURRENT_USER, Software\Microsoft\Windows\CurrentVersion\Explorer\Advanced, Hidden, 1
else
  RegWrite, REG_DWORD, HKEY_CURRENT_USER, Software\Microsoft\Windows\CurrentVersion\Explorer\Advanced, Hidden, 2
return 

However, as said before, the problem seems to be in refreshing the registry but, if after running the script i run regedit and update using F5 manually, then turn to explorer and press F5 the changes are not shown.

On the other and, if, after running the script, i manually go to tools -> folder options.. -> second tab (see or view), i can see that the option has changed and if i close the window (not even need to press accept) then the trick is done.

Conclusion 1: I believe that there is another string or value in the registry that has to be changed in order to get the job done with only refreshing the explorer window.

I made a log of changes in the registry using Regmon, but had no luck...

Conclusion 2: If not the registry then maybe a dll should be "refreshed".

Any ideas?

EDIT: I found this: http://www.edbott.co...ves/000692.html
This person wrote the script but with vb, and again i have the same problem. So i think that is something about my configuration or my win (Me, by the way).

teamyoyo
  • Members
  • 1 posts
  • Last active: Nov 01 2013 09:35 PM
  • Joined: 04 Jan 2006

EDIT: I found this: http://www.edbott.co...ves/000692.html
This person wrote the script but with vb, and again i have the same problem. So i think that is something about my configuration or my win (Me, by the way).


Just to let you know I tryed Ed Bott's script. It has the same problem of changes not happening on screen. I found that if I right click and select refresh on the context menu the hidden files actually appear. I'm not sure why this works but it does.

I've been thinking about why the changes don't take effect. When the setting is changed explorer.exe doesn't know about the change. It only checks those settings when it starts. The answer might be to start a new explorer.exe process and then close it so explorer knows about the changes and then use F5 to refresh the open window.

Calabaza
  • Members
  • 9 posts
  • Last active: Mar 02 2006 07:21 PM
  • Joined: 24 Dec 2005
Well, just right clicking and then refreshing is ok for me, much more faster than doing it by hand as before...

Thanks for the tip...

bobbo
  • Members
  • 15 posts
  • Last active: Oct 10 2010 01:08 AM
  • Joined: 19 Mar 2007
In case you haven't figured out how to cause a Windows Explorer refresh yet:
(from http://www.autohotke...topic13509.html)
PostMessage, 0x111, 41504,,, ahk_id %ID%
PostMessage, 0x111, 28931,,, ahk_id %ID%
Which one to use depends on which version of Windows you have; there doesn't seem to be any problem sending both just to be sure.

Raf
  • Guests
  • Last active:
  • Joined: --
Is there a way in vb to hide the hidden files from the windows explorer ciew; i.e. do what Folders Options > View > Do not show hidden files > Refresh? Thanks

Raf
  • Guests
  • Last active:
  • Joined: --

In case you haven't figured out how to cause a Windows Explorer refresh yet:
(from http://www.autohotke...topic13509.html)

PostMessage, 0x111, 41504,,, ahk_id %ID%
PostMessage, 0x111, 28931,,, ahk_id %ID%
Which one to use depends on which version of Windows you have; there doesn't seem to be any problem sending both just to be sure.



Hello:

Thanks. I use only VB.NET ... any help with that language?

Raf
  • Guests
  • Last active:
  • Joined: --

EDIT: I found this: http://www.edbott.co...ves/000692.html
This person wrote the script but with vb, and again i have the same problem. So i think that is something about my configuration or my win (Me, by the way).


Just to let you know I tryed Ed Bott's script. It has the same problem of changes not happening on screen. I found that if I right click and select refresh on the context menu the hidden files actually appear. I'm not sure why this works but it does.

I've been thinking about why the changes don't take effect. When the setting is changed explorer.exe doesn't know about the change. It only checks those settings when it starts. The answer might be to start a new explorer.exe process and then close it so explorer knows about the changes and then use F5 to refresh the open window.


Thanks. That approach toggels the "show hidden" and "do not show hidden" files BUT the hidden file remains visible on the screen. Ed was notified and he had no time to search the problem.

Raf
  • Guests
  • Last active:
  • Joined: --

Whenever i run this code, it actually does its job, it changes the values

#h::
RegRead, ValorHidden, HKEY_CURRENT_USER, Software\Microsoft\Windows\CurrentVersion\Explorer\Advanced, Hidden
if ValorHidden = 2
  RegWrite, REG_DWORD, HKEY_CURRENT_USER, Software\Microsoft\Windows\CurrentVersion\Explorer\Advanced, Hidden, 1
else
  RegWrite, REG_DWORD, HKEY_CURRENT_USER, Software\Microsoft\Windows\CurrentVersion\Explorer\Advanced, Hidden, 2
return 

However, as said before, the problem seems to be in refreshing the registry but, if after running the script i run regedit and update using F5 manually, then turn to explorer and press F5 the changes are not shown.

On the other and, if, after running the script, i manually go to tools -> folder options.. -> second tab (see or view), i can see that the option has changed and if i close the window (not even need to press accept) then the trick is done.

Conclusion 1: I believe that there is another string or value in the registry that has to be changed in order to get the job done with only refreshing the explorer window.

I made a log of changes in the registry using Regmon, but had no luck...

Conclusion 2: If not the registry then maybe a dll should be "refreshed".

Any ideas?

EDIT: I found this: http://www.edbott.co...ves/000692.html
This person wrote the script but with vb, and again i have the same problem. So i think that is something about my configuration or my win (Me, by the way).


Thanks. I use vb.net only. I appreciate any help with that.

EdBott's approach toggles the "show" and "do not show" hidden files BUT the hidden file remains visible on the screen. Ed is aware of the problem and had not had time to search for the solution.