Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- ; HiddenFiles.ahk by r0lZ, June 5, 2011
- #NoEnv
- #SingleInstance ignore
- #UseHook off
- #Persistent
- Menu, tray, noicon
- ControlGet, hwWindow, HWND,, SysListView321, ahk_class Progman
- if hwWindow {
- ; Win XP
- desktopclassname := "Progman"
- explorerlistview := "SysListView321"
- } else {
- ; Win 7
- desktopclassname := "WorkerW"
- explorerlistview := "DirectUIHWND3"
- }
- GroupAdd, ExplorerWindowsGroup, ahk_class CabinetWClass
- firstarg =
- if 0 >= 1
- {
- firstarg = %1%
- if (firstarg == "/h")
- ShowHiddenFiles(0)
- else if (firstarg == "/s")
- ShowHiddenFiles(1)
- else if (firstarg == "/sh")
- ShowHiddenFiles(2)
- else if (firstarg == "/swap")
- Gosub, ToggleHiddenFiles
- else
- GoSub, Usage
- ExitApp
- }
- menu, tray, NoStandard
- menu, tray, Add, Help, Usage
- menu, tray, Add, Exit, CleanExit
- menu, tray, Add
- menu, tray, Add, Hide Hidden Files, HideHiddenFiles
- menu, tray, Add, Show Hidden Files, ShowHiddenFiles
- menu, tray, Add, Show Hidden and System Files, ShowSystemFiles
- menu, tray, Add
- menu, tray, Add, Swap Show/Hide Hidden Files, ToggleHiddenFiles
- menu, tray, Default, Swap Show/Hide Hidden Files
- menu, tray, Icon
- ; monitors buttons clicks on tray icon
- OnMessage(0x404, "OnWM_BUTTONUPMessage") ; 0x404 = AHK_NOTIFYICON
- Return
- ToggleHiddenFiles:
- RegRead, ValorHidden, HKEY_CURRENT_USER, Software\Microsoft\Windows\CurrentVersion\Explorer\Advanced, Hidden
- if (ValorHidden == 2)
- ShowHiddenFiles(1)
- else
- ShowHiddenFiles(0)
- Return
- HideHiddenFiles:
- ShowHiddenFiles(0)
- Return
- ShowHiddenFiles:
- ShowHiddenFiles(1)
- Return
- ShowSystemFiles:
- ShowHiddenFiles(2)
- Return
- ShowHiddenFiles(mode) {
- if (mode == 0) {
- RegWrite, REG_DWORD, HKEY_CURRENT_USER, Software\Microsoft\Windows\CurrentVersion\Explorer\Advanced, Hidden, 2
- } else if (mode == 1) {
- RegWrite, REG_DWORD, HKEY_CURRENT_USER, Software\Microsoft\Windows\CurrentVersion\Explorer\Advanced, Hidden, 1
- RegWrite, REG_DWORD, HKEY_CURRENT_USER, Software\Microsoft\Windows\CurrentVersion\Explorer\Advanced, ShowSuperHidden, 0
- } else {
- RegWrite, REG_DWORD, HKEY_CURRENT_USER, Software\Microsoft\Windows\CurrentVersion\Explorer\Advanced, Hidden, 1
- RegWrite, REG_DWORD, HKEY_CURRENT_USER, Software\Microsoft\Windows\CurrentVersion\Explorer\Advanced, ShowSuperHidden, 1
- }
- sleep, 10
- RefreshExplorerWindows()
- ; refresh all Explorer windows
- ControlSend, DirectUIHWND3, {F5}, ahk_group ExplorerWindowsGroup
- return
- }
- RefreshExplorerWindows()
- {
- global desktopclassname, explorerlistview
- ; refresh Desktop
- ControlSend, ahk_parent, {F5}, ahk_class %desktopclassname%
- ; refresh all Explorer windows
- ControlSend, %explorerlistview%, {F5}, ahk_group ExplorerWindowsGroup
- return
- }
- OnWM_BUTTONUPMessage(wParam, lParam)
- {
- Critical
- ; Refresh tray menu if Right button pressed
- if (lParam == 0x204) {
- RegRead, ValorHidden, HKEY_CURRENT_USER, Software\Microsoft\Windows\CurrentVersion\Explorer\Advanced, Hidden
- RegRead, ShowSuperHidden, HKEY_CURRENT_USER, Software\Microsoft\Windows\CurrentVersion\Explorer\Advanced, ShowSuperHidden
- menu, tray, UnCheck, Hide Hidden Files
- menu, tray, UnCheck, Show Hidden Files
- menu, tray, UnCheck, Show Hidden and System Files
- if (ValorHidden == 2) {
- menu, tray, Check, Hide Hidden Files
- } else {
- if (ShowSuperHidden) {
- menu, tray, Check, Show Hidden and System Files
- } else {
- menu, tray, Check, Show Hidden Files
- }
- }
- }
- Critical, off
- }
- Usage:
- MsgBox, 64, HiddenFiles by r0lZ - Freeware, HiddenFiles is an easy way to show or hide the hidden files in all Explorer windows and on the Desktop.`n`nCommand line usage:`nHiddenFiles /h -> Hide hidden files`nHiddenFiles /s -> Show hidden files`nHiddenFiles /sh -> Show hidden and system files`nHiddenFiles /swap -> Swap Show/Hide hidden files`nHiddenFiles /? -> Show this help dialogue`nHiddenFiles -> Without argument, stays resident in the tray
- Return
- CleanExit:
- ExitApp
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement