Jump to content

Toggle hidden/system files in XP


Xichael
 Share

Recommended Posts

In XP, this will toggle the visibility of hidden & system files with WIN+H (provided that you start out with those files hidden and don't manually switch their state while the script is running):

#NoTrayIcon

HotKeySet("#h", "ToggleHiddenFiles")

Global $LastFileState = 0

While 1
    Sleep(50)
WEnd

Func ToggleHiddenFiles()
    If $LastFileState = 0 Or $LastFileState = 1 Then
        ShowFiles()
        $LastFileState = 2
    Else
        HideFiles()
        $LastFileState = 1
    EndIf
EndFunc

Func ShowFiles()
    Run("control folders")
    WinWaitActive("Folder Options")
    Send("^{TAB}")
    Sleep(50)
    Send("{TAB}")
    Send("{DOWN}")
    Send("{DOWN}")
    Send("{DOWN}")
    Send("{DOWN}")
    Send("{DOWN}")
    Send("{DOWN}")
    Send("{DOWN}")
    Send("{DOWN}")
    Send("{DOWN}")
    Send("{DOWN}")
    Send("{SPACE}")
    Send("{DOWN}")
    Send("{DOWN}")
    Send("{SPACE}")
    WinWaitActive("Warning")
    Send("{LEFT}")
    Send("{ENTER}")
    WinWaitActive("Folder Options")
    Send("{TAB}")
    Send("{TAB}")
    Send("{ENTER}")
EndFunc

Func HideFiles()
    Run("control folders")
    WinWaitActive("Folder Options")
    Send("^{TAB}")
    Sleep(50)
    Send("{TAB}")
    Send("{DOWN}")
    Send("{DOWN}")
    Send("{DOWN}")
    Send("{DOWN}")
    Send("{DOWN}")
    Send("{DOWN}")
    Send("{DOWN}")
    Send("{DOWN}")
    Send("{DOWN}")
    Send("{SPACE}")
    Send("{DOWN}")
    Send("{DOWN}")
    Send("{DOWN}")
    Send("{SPACE}")
    Send("{TAB}")
    Send("{TAB}")
    Send("{ENTER}")
EndFunc
Edited by Xichael
Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
 Share

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...