AutoHotkey Community

It is currently May 27th, 2012, 5:23 am

All times are UTC [ DST ]




Post new topic Reply to topic  [ 34 posts ]  Go to page 1, 2, 3  Next
Author Message
 Post subject: Toggle Hidden Files
PostPosted: October 29th, 2004, 8:11 pm 
Offline

Joined: August 17th, 2004, 7:05 pm
Posts: 38
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


Report this post
Top
 Profile  
Reply with quote  
 Post subject:
PostPosted: October 29th, 2004, 9:27 pm 
Offline

Joined: March 2nd, 2004, 3:36 pm
Posts: 10720
Thanks for posting it. By the way, you can replace things like "{Down}...{Down}" with "{Down 10}" if you prefer.


Report this post
Top
 Profile  
Reply with quote  
 Post subject:
PostPosted: October 30th, 2004, 7:35 am 
Offline

Joined: May 4th, 2004, 6:15 pm
Posts: 68
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

_________________
Image


Report this post
Top
 Profile  
Reply with quote  
 Post subject:
PostPosted: December 24th, 2005, 7:47 am 
Offline

Joined: December 24th, 2005, 7:29 am
Posts: 9
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)


Report this post
Top
 Profile  
Reply with quote  
 Post subject:
PostPosted: December 25th, 2005, 2:26 am 
Offline

Joined: December 21st, 2005, 10:58 pm
Posts: 2
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


Report this post
Top
 Profile  
Reply with quote  
 Post subject:
PostPosted: December 28th, 2005, 6:59 am 
Offline

Joined: December 24th, 2005, 7:29 am
Posts: 9
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.


Report this post
Top
 Profile  
Reply with quote  
 Post subject:
PostPosted: December 28th, 2005, 12:25 pm 
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?


Report this post
Top
  
Reply with quote  
 Post subject:
PostPosted: December 28th, 2005, 8:15 pm 
Offline

Joined: December 24th, 2005, 7:29 am
Posts: 9
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).


Report this post
Top
 Profile  
Reply with quote  
 Post subject:
PostPosted: January 4th, 2006, 2:27 pm 
Offline

Joined: January 4th, 2006, 2:14 pm
Posts: 1
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.


Report this post
Top
 Profile  
Reply with quote  
 Post subject:
PostPosted: January 14th, 2006, 6:49 am 
Offline

Joined: December 24th, 2005, 7:29 am
Posts: 9
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...


Report this post
Top
 Profile  
Reply with quote  
 Post subject: How to refresh
PostPosted: March 29th, 2007, 7:56 pm 
Offline

Joined: March 19th, 2007, 2:36 pm
Posts: 15
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.


Report this post
Top
 Profile  
Reply with quote  
PostPosted: January 18th, 2008, 2:34 pm 
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


Report this post
Top
  
Reply with quote  
 Post subject: Re: How to refresh
PostPosted: January 23rd, 2008, 2:43 am 
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?


Report this post
Top
  
Reply with quote  
 Post subject: refreshing
PostPosted: January 23rd, 2008, 2:45 am 
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.


Report this post
Top
  
Reply with quote  
 Post subject:
PostPosted: January 23rd, 2008, 2:49 am 
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.


Report this post
Top
  
Reply with quote  
Display posts from previous:  Sort by  
Post new topic Reply to topic  [ 34 posts ]  Go to page 1, 2, 3  Next

All times are UTC [ DST ]


Who is online

Users browsing this forum: nomissenrojb and 10 guests


You can post new topics in this forum
You can reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot post attachments in this forum

Search for:
Powered by phpBB® Forum Software © phpBB Group