Jump to content

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

Show/Hide Hidden files and folders


  • Please log in to reply
18 replies to this topic
jps
  • Members
  • 279 posts
  • Last active: Sep 11 2011 07:26 PM
  • Joined: 02 Sep 2006
Can anyone tell me a way to make a hotkey toggle whether hidden files and folders are shown or not?

I've searched but havent been able to find anything.

AiKscroll
  • Members
  • 179 posts
  • Last active: Feb 25 2007 03:10 AM
  • Joined: 06 Jun 2005
First you have to resolve how you want this done. Is it acceptable to have the script launch Control panel, then Folder options, then check the correct box, etc? Or is it not, say you want to do this in the middle of a game.

If you want it done without the messing with the many steps, you need to figure out what windows is doing when you show/hide folders whether it be messing with the registry, writing to an ini, or whatever. Knowing that will help you determine how to go about solving this problem.

If anyone knows what the Folder Options dialog does when you check/uncheck Show hidden files please mention it, cause I don't know.
_AiK

SKAN
  • Administrators
  • 9115 posts
  • Last active:
  • Joined: 26 Dec 2005

Can anyone tell me a way to make a hotkey toggle whether hidden files and folders are shown or not?


If anyone knows what the Folder Options dialog does when you check/uncheck Show hidden files please mention it, cause I don't know.


The following code toggles the hidden files view, in Windows Explorer:

^F2::GoSub,CheckActiveWindow

CheckActiveWindow:
  ID := WinExist("A")
  WinGetClass,Class, ahk_id %ID%
  WClasses := "CabinetWClass ExploreWClass"
  IfInString, WClasses, %Class%
    GoSub, Toggle_HiddenFiles_Display
Return

Toggle_HiddenFiles_Display:
  RootKey = HKEY_CURRENT_USER
  SubKey  = Software\Microsoft\Windows\CurrentVersion\Explorer\Advanced

  RegRead, HiddenFiles_Status, % RootKey, % SubKey, Hidden

  if HiddenFiles_Status = 2
      RegWrite, REG_DWORD, % RootKey, % SubKey, Hidden, 1 
  else 
      RegWrite, REG_DWORD, % RootKey, % SubKey, Hidden, 2
  PostMessage, 0x111, 41504,,, ahk_id %ID%
Return

See: How to Toggle Hidden files view in Windows Explorer?

Regards, :)
kWo4Lk1.png

aCkRiTe
  • Members
  • 577 posts
  • Last active: Jun 21 2013 11:01 PM
  • Joined: 21 Jul 2006
I see Goyyah beat me to it. :lol: This is what I came up with though

#SingleInstance Force 
#Persistent
#NoEnv
SetBatchLines, -1
Value = 1
#H::
If Value = 1
	Value = 2
Else
	Value = 1
RegWrite, REG_DWORD, HKEY_CURRENT_USER, Software\Microsoft\Windows\CurrentVersion\Explorer\Advanced\, Hidden, %Value%

More info here...
http://www.winguides...splay.php/1007/

SKAN
  • Administrators
  • 9115 posts
  • Last active:
  • Joined: 26 Dec 2005

This is what I came up with though


Nice :D.. I had borrowed the code except for PostMessage, 0x111, 41504,,, which simulates the F5 (refresh).

Regards, :)
kWo4Lk1.png

aCkRiTe
  • Members
  • 577 posts
  • Last active: Jun 21 2013 11:01 PM
  • Joined: 21 Jul 2006
Ahh... I forgot the Refresh{F5} part... Thanks Goyyah! I always learn something in here!

Hansol
  • Members
  • 36 posts
  • Last active: Aug 02 2011 07:31 PM
  • Joined: 27 Dec 2005

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.

http://www.autohotke...opic.php?t=1204
Is there any way to solve that problem? The changes is done but take no effect?

SKAN
  • Administrators
  • 9115 posts
  • Last active:
  • Joined: 26 Dec 2005

Is there any way to solve that problem? The changes is done but take no effect?


I see the point.. I had tested that code only in Windows 98 SE.. It does not seem to work in Windows 2000 for me now! :(

I will try and find a way & post again.. Thanks! :)
kWo4Lk1.png

aCkRiTe
  • Members
  • 577 posts
  • Last active: Jun 21 2013 11:01 PM
  • Joined: 21 Jul 2006
I havent tested, but would this work...

Run, %A_WinDir%\System32\RUNDLL32.EXE user32.dll`,UpdatePerUserSystemParameters


SKAN
  • Administrators
  • 9115 posts
  • Last active:
  • Joined: 26 Dec 2005

but would this work...


It does not :( ..
kWo4Lk1.png

jps
  • Members
  • 279 posts
  • Last active: Sep 11 2011 07:26 PM
  • Joined: 02 Sep 2006
Thanks for the replies guys :D

I find pressing F5 works only some of the time but pressing the Appskey and then e works every time.

I can live with the right-click menu showing for a brief second so I tried incorporating that into the script but with no avail.

Could you edit one of the scripts to refresh that way for me?

Sorry for just straight up asking you guys to do stuff for me but i'm really struggling to get the hang of scripting.I'm sure i'll get there in the end but it will take a while.The only programing experience i have was using basic at school 10 years ago lol

SKAN
  • Administrators
  • 9115 posts
  • Last active:
  • Joined: 26 Dec 2005

Could you edit one of the scripts to refresh that way for me?


Replace the PostMessage line with

Send {AppsKey}e

Regards, :)

PS: Keep a watch on this topic.. I will post again if I come out with something more elegant!
kWo4Lk1.png

Conquer
  • Members
  • 385 posts
  • Last active: Jan 10 2013 02:14 AM
  • Joined: 27 Jun 2006
AppsKey & E Code:
Send {AppsKey}E

EDIT:
That was a fast reply, goyah!! Beat mine... :(

jps
  • Members
  • 279 posts
  • Last active: Sep 11 2011 07:26 PM
  • Joined: 02 Sep 2006
Thanks for such a quick reply. It works a charm. :D

I always get mixed up with where to put my curly braces

SKAN
  • Administrators
  • 9115 posts
  • Last active:
  • Joined: 26 Dec 2005

That was a fast reply, goyah!! Beat mine... :(


That happens many times for me too :D
kWo4Lk1.png