I want the script to refresh/update the desktop and all existing windows as well so i don't have to manually refresh all the other windows and the desktop.
So here's a script in Autoit3. It Refreshes all open windows including the desktop all at once like when you make changes under the view tab of the folder options. It shows system files as well. Just press winkey+h.
Code:
Opt ("WinTitleMatchMode", 4)
HotKeySet ("#h", "SH")
Func SH()
$key = "HKEY_CURRENT_USER\Software\Microsoft\Windows\CurrentVersion\Explorer\Advanced"
$read = RegRead ($key, "Hidden")
If $read = 1 Then
RegWrite ($key, "Hidden", "REG_DWORD", "2")
RegWrite ($key, "ShowSuperHidden", "REG_DWORD", "0")
UpdateExplorer()
Else
RegWrite ($key, "Hidden", "REG_DWORD", "1")
RegWrite ($key, "ShowSuperHidden", "REG_DWORD", "1")
UpdateExplorer()
EndIf
EndFunc
Func UpdateExplorer()
$Win = WinList ("classname=CabinetWClass")
If IsArray ($Win) Then
For $i = 1 To $Win[0][0]
DllCall ("user32.dll", "long", "SendMessage", "hwnd", $Win[$i][1], "int", 0x111, "int", 28931, "int", 0)
Next
EndIf
DllCall ("user32.dll", "long", "SendMessage", "hwnd", WinGetHandle ("classname=Progman"), "int", 0x111, "int", 28931, "int", 0)
EndFunc
While 1
Sleep (10000)
WEnd
and the compiled script..