AutoHotkey Homepage AutoHotkey Community
Let's help each other out
 
 FAQFAQ   SearchSearch   MemberlistMemberlist   RegisterRegister 
 ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 

Toggle Hidden Files
Goto page 1, 2  Next
 
Post new topic   Reply to topic    AutoHotkey Community Forum Index -> Scripts & Functions
View previous topic :: View next topic  
Author Message
thinkstorm



Joined: 17 Aug 2004
Posts: 18

PostPosted: Fri Oct 29, 2004 8:11 pm    Post subject: Toggle Hidden Files Reply with quote

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....
Code:

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
Back to top
View user's profile Send private message
Chris
Site Admin


Joined: 02 Mar 2004
Posts: 10467

PostPosted: Fri Oct 29, 2004 9:27 pm    Post subject: Reply with quote

Thanks for posting it. By the way, you can replace things like "{Down}...{Down}" with "{Down 10}" if you prefer.
Back to top
View user's profile Send private message Send e-mail
compuboy_r



Joined: 04 May 2004
Posts: 68

PostPosted: Sat Oct 30, 2004 7:35 am    Post subject: Reply with quote

Try this one it does not even need the Explorer Window


Code:
^!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

_________________
Back to top
View user's profile Send private message
Calabaza



Joined: 24 Dec 2005
Posts: 9

PostPosted: Sat Dec 24, 2005 7:47 am    Post subject: Reply with quote

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.

Code:

#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)
Back to top
View user's profile Send private message
TheNewOne



Joined: 21 Dec 2005
Posts: 2

PostPosted: Sun Dec 25, 2005 2:26 am    Post subject: Reply with quote

this works for me, if Explorer is open:

Code:
^!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
Back to top
View user's profile Send private message
Calabaza



Joined: 24 Dec 2005
Posts: 9

PostPosted: Wed Dec 28, 2005 6:59 am    Post subject: Reply with quote

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.
Back to top
View user's profile Send private message
not-logged-in-daonlyfreez
Guest





PostPosted: Wed Dec 28, 2005 12:25 pm    Post subject: Reply with quote

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?
Back to top
Calabaza



Joined: 24 Dec 2005
Posts: 9

PostPosted: Wed Dec 28, 2005 8:15 pm    Post subject: Reply with quote

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

#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.com/weblog/archives/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).
Back to top
View user's profile Send private message
teamyoyo



Joined: 04 Jan 2006
Posts: 1

PostPosted: Wed Jan 04, 2006 2:27 pm    Post subject: Reply with quote

Calabaza wrote:

EDIT: I found this: http://www.edbott.com/weblog/archives/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.
Back to top
View user's profile Send private message
Calabaza



Joined: 24 Dec 2005
Posts: 9

PostPosted: Sat Jan 14, 2006 6:49 am    Post subject: Reply with quote

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...
Back to top
View user's profile Send private message
bobbo



Joined: 19 Mar 2007
Posts: 14

PostPosted: Thu Mar 29, 2007 7:56 pm    Post subject: How to refresh Reply with quote

In case you haven't figured out how to cause a Windows Explorer refresh yet:
(from http://www.autohotkey.com/forum/topic13509.html)
Code:
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.
Back to top
View user's profile Send private message
Raf
Guest





PostPosted: Fri Jan 18, 2008 2:34 pm    Post subject: hid hidden files from windows explorer Reply with quote

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
Back to top
Raf
Guest





PostPosted: Wed Jan 23, 2008 2:43 am    Post subject: Re: How to refresh Reply with quote

bobbo wrote:
In case you haven't figured out how to cause a Windows Explorer refresh yet:
(from http://www.autohotkey.com/forum/topic13509.html)
Code:
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?
Back to top
Raf
Guest





PostPosted: Wed Jan 23, 2008 2:45 am    Post subject: refreshing Reply with quote

teamyoyo wrote:
Calabaza wrote:

EDIT: I found this: http://www.edbott.com/weblog/archives/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.
Back to top
Raf
Guest





PostPosted: Wed Jan 23, 2008 2:49 am    Post subject: Reply with quote

Calabaza wrote:
Whenever i run this code, it actually does its job, it changes the values
Code:

#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.com/weblog/archives/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.
Back to top
Display posts from previous:   
Post new topic   Reply to topic    AutoHotkey Community Forum Index -> Scripts & Functions All times are GMT
Goto page 1, 2  Next
Page 1 of 2

 
Jump to:  
You can post new topics in this forum
You can reply to topics in this forum


Powered by phpBB © 2001, 2005 phpBB Group