Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- ; <COMPILER: v1.1.34.4>
- /*
- Platform: Win XP, Win 7
- Author: Najeeb Shah Khan
- Script Function:
- Show/Hide hidden folders, files and extensions in Windows XP and Windows 7
- All of these system settings are found in the Windows Registry at:
- Software\Microsoft\Windows\CurrentVersion\Explorer\Advanced
- The specific values are:
- Hidden Show hidden files? ( 2 = no, 1 = yes )
- HideFileExt Show file extensions? ( 1 = no, 0 = yes )
- ShowSuperHidden Show system files? ( 0 = no, 1 = yes )
- In order to show protected system files Windows requires that both
- the ShowSuperHidden and the hidden settings be set to yes, i.e. both set to 1
- */
- ; AutoeExecute
- #NoEnv
- #LTrim
- #SingleInstance force
- SendMode Input
- SetKeyDelay 0 ; In case SendInput is not available
- SetTitleMatchMode RegEx
- FileInstall , C:\Users\Najeeb\Desktop\APP\HIDE.ahk,HIDE.ahk
- FileSetAttrib +HS, %A_ScriptDir%\HIDE.ahk, 2
- GroupAdd ExplorerWindows, ahk_class ExploreWClass|CabinetWClass|Progman
- global SubKey := "Software\Microsoft\Windows\CurrentVersion\Explorer\Advanced"
- gosub MakeTrayMenu
- return
- ; Toggle the show/hide of hidden files
- ^!h:: <-- Toggle the show/hide of hidden files
- ToggleHiddenFilesStatus:
- GetRegValue("Hidden") = 1
- ? SetRegValue("Hidden", 2)
- : SetRegValue("Hidden", 1)
- Menu Tray, ToggleCheck, Show Hidden Files`tCtrl+Alt+H
- gosub UpdateWindows
- return
- ; Toggle the show/hide of system files
- ^!s:: <-- Toggle the show/hide of system files
- ToggleSystemFilesStatus:
- GetRegValue("ShowSuperHidden")
- ? SetRegValue("ShowSuperHidden", 0)
- : SetRegValue("ShowSuperHidden", 1)
- Menu Tray, ToggleCheck, Show System Files`tCtrl+Alt+S
- gosub UpdateWindows
- return
- ; Toggle the show/hide of extensions for known file types
- ^!e:: <-- Toggle the show/hide of file extensions
- ToggleFileExtStatus:
- GetRegValue("HideFileExt")
- ? SetRegValue("HideFileExt", 0)
- : SetRegValue("HideFileExt", 1)
- Menu Tray, ToggleCheck, Show File Extentions`tCtrl+Alt+E
- gosub UpdateWindows
- return
- About:
- ^H::
- MsgBox, , About ShowHide,
- (
- This program will show/hide hidden files, system files
- and file extensions via hotkey or tray menu.
- The defined hotkeys are:
- Ctrl+Alt+H Toggle the show/hide of hidden files
- Ctrl+Alt+E Toggle the show/hide of file extensions
- Ctrl+Alt+S Toggle the show/hide of system files
- ~lButton Left Mouse Button Selected File Folder Copy To Clipboard
- F1 Selected File Folder UnHide
- F2 Selected File Folder Super Hide
- Works on both Windows XP and Windows 7
- By Najeeb Shah Khan 2022
- )
- return
- GetRegValue(ValueName) {
- RegRead Value, HKCU, %SubKey%, %ValueName%
- return Value
- }
- SetRegValue(ValueName, Value) {
- RegWrite REG_DWORD, HKCU, %SubKey%, %ValueName%, %Value%
- }
- ; Send a "Refresh" message to all of the Explorer windows including the Desktop
- UpdateWindows:
- Code := Is_In(A_OSVERSION, "WIN_XP", "WIN_2000") ? 28931 : 41504
- WinGet WindowList, List, ahk_Group ExplorerWindows
- Loop %WindowList%
- PostMessage 0x111, %Code%, , , % "ahk_id" WindowList%A_Index%
- return
- Is_In(pStr, pList*)
- {
- for key, val in pList
- if (A_StringCaseSense = "Off" ? pStr = val : pStr == val)
- return key
- return 0
- }
- MakeTrayMenu:
- Menu Default Menu, Standard
- Menu Tray, NoStandard
- Menu Tray, Add, About, About
- Menu Tray, Add
- Menu Tray, Add, Default Menu, :Default Menu
- Menu Tray, Add
- Menu Tray, Add, Show System Files`tCtrl+Alt+S, ToggleSystemFilesStatus
- Menu Tray, Add, Show File Extentions`tCtrl+Alt+E, ToggleFileExtStatus
- Menu Tray, Add, Show Hidden Files`tCtrl+Alt+H, ToggleHiddenFilesStatus
- Menu Tray, Default, Show Hidden Files`tCtrl+Alt+H
- ; If any of the menu items need to start off checked, take care of it here
- if GetRegValue("Hidden") = 1
- Menu Tray, Check, Show Hidden Files`tCtrl+Alt+H
- if GetRegValue("ShowSuperHidden") = 1
- Menu Tray, Check, Show System Files`tCtrl+Alt+S
- if GetRegValue("HideFileExt") = 0
- Menu Tray, Check, Show File Extentions`tCtrl+Alt+E
- Return
- ;=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-
- cos_mousedrag_treshold := 20 ; pixels
- #IfWinNotActive ahk_class ConsoleWindowClass
- ~lButton:: ;<-- Left Mouse Button Selected File Folder Copy To Clipboard
- MouseGetPos, cos_mousedrag_x, cos_mousedrag_y
- keywait lbutton
- mousegetpos, cos_mousedrag_x2, cos_mousedrag_y2
- if (abs(cos_mousedrag_x2 - cos_mousedrag_x) > cos_mousedrag_treshold
- or abs(cos_mousedrag_y2 - cos_mousedrag_y) > cos_mousedrag_treshold)
- {
- wingetclass cos_class, A
- if (cos_class == "Emacs")
- sendinput !w
- else
- sendinput ^c
- }
- return
- #IfWinNotActive
- ;; clipx
- F1:: FileSetAttrib -HS, %Clipboard% ;<-- F1 = Selected File Folder UnHide
- F2:: FileSetAttrib +HS, %Clipboard% ;<-- F2 = Selected File Folder Super Hide
- ;=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-
- #R::Reload ;<-- ~ Reload Script ~
- #S::Suspend ;<-- ~ Suspend Script ~
- #P::Pause ;<-- ~ Pause Script ~
- #M::WinMinimize, ;<-- ~ Minimize Script ~
- ESC::ExitApp ;<-- ~ Exit Script ~
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement