Search the Community
Showing results for tags 'refresh windows explorer'.
-
this script works fine for the desktop, but if i open e.g. the folder "c:" and i click a button, i still don't see changes, nothing refreshes until i hit F5. its a small tool for my dad to quickly show or hide hidden files with a button in a gui... for some reason the F5 key (with sendkeys) doesn't work so 'sendkeys("F5")' is not an option... any help is welcome! #NoTrayIcon #Region #AutoIt3Wrapper_Icon=X.ico #AutoIt3Wrapper_UseUpx=n #AutoIt3Wrapper_UseX64=n #EndRegion #include <Process.au3> ; Quit with message box if app is already running $numberOfAppInstances = ProcessList(_ProcessGetName(@AutoItPID)) $numberOfAppInstances = $numberOfAppInstances[0][0] If $numberOfAppInstances > 1 Then MsgBox(48+4096, "Exiting...", "ShowHide application already running!") Exit EndIf Func _IsRegistryExist($sKeyName, $sValueName) RegRead($sKeyName, $sValueName) Return Number(@error = 0) EndFunc ;==>_IsRegistryExist If _IsRegistryExist("HKEY_CLASSES_ROOT\Folder\shell\MapOptiesSH_V4\command", "") = 0 Then MsgBox(262208,"Menu.","Hi there!" & @CRLF & "This is the first time you start ShowHide so there will be a new item in the folder context menu...") RegWrite("HKEY_CLASSES_ROOT\Folder\shell\MapOptiesSH_V4\command", "", "REG_SZ", "C:\\ShowHide_4.exe") EndIf #include <ButtonConstants.au3> #include <GUIConstantsEx.au3> #include <StaticConstants.au3> #include <WindowsConstants.au3> #include <SendMessage.au3> ;################################################################################################; Global $hidden_reg_show = 1 Global $supper_hidden_reg_show = 1 Global $ext_reg_show = 0 Global $hidden_reg_hide = 2 Global $supper_hidden_reg_hide = 0 Global $ext_reg_hide = 1 Global $hidden_reg = RegRead("HKCU\Software\Microsoft\Windows\CurrentVersion\Explorer\Advanced", "Hidden") Global $Shidden_reg = RegRead("HKCU\Software\Microsoft\Windows\CurrentVersion\Explorer\Advanced", "ShowSuperHidden") Global $ext_reg = RegRead("HKCU\Software\Microsoft\Windows\CurrentVersion\Explorer\Advanced", "HideFileExt") ;################################################################################################; Opt("TrayOnEventMode", 1) Opt("TrayMenuMode", 1) ; Default tray menu items (Script Paused/Exit) will not be shown. TraySetState(2) ;################################################################################################; Func tik($byval) SoundPlay('C:\snd.wav', $byval) EndFunc ;==>tik ;################################################################################################; global $form = GUICreate("ShowHide", 432, 264, -1, -1, $WS_POPUP, $WS_EX_LAYERED) global $RESET = GUICtrlCreateLabel('', 35, 203, 266, 38) GUICtrlSetCursor(-1, 0) global $TRAY = GUICtrlCreateLabel('', 311, 203, 98, 38) GUICtrlSetCursor(-1, 0) global $GUI = GUICtrlCreatePic("C:\gui.bmp", 0, 36, 432, 228) GUICtrlSetState(-1, $GUI_DISABLE) global $b1 = GUICtrlCreatePic('C:\f1.bmp', 35, 47, 266, 38) GUICtrlSetCursor(-1, 0) global $b2 = GUICtrlCreatePic('C:\s1.bmp', 35, 95, 266, 38) GUICtrlSetCursor(-1, 0) global $b3 = GUICtrlCreatePic('C:\x1.bmp', 35, 143, 266, 38) GUICtrlSetCursor(-1, 0) global $STOP = GUICtrlCreateLabel('', 395, 11, 26, 14) GUICtrlSetCursor(-1, 0) global $MIN = GUICtrlCreateLabel('', 359, 11, 26, 14) GUICtrlSetCursor(-1, 0) global $DRAG = GUICtrlCreatePic("drag.bmp", 0, 0, 432, 36, -1, $GUI_WS_EX_PARENTDRAG) GUISetState(@SW_SHOW) ;################################################################################################; If $hidden_reg = $hidden_reg_show Then Global $box1 = "aan" buttonset(1, $box1) Else Global $box1 = "uit" buttonset(1, $box1) EndIf If $Shidden_reg = $supper_hidden_reg_show Then Global $box2 = "aan" buttonset(2, $box2) Else Global $box2 = "uit" buttonset(2, $box2) EndIf If $ext_reg = $ext_reg_show Then Global $box3 = "aan" buttonset(3, $box3) Else Global $box3 = "uit" buttonset(3, $box3) EndIf Func buttonset($but_int, $but_aan_uit) Switch $but_int Case 1 If $but_aan_uit = 'uit' Then GUICtrlSetImage($b1, "C:\f0.bmp") Else GUICtrlSetImage($b1, "C:\f1.bmp") EndIf Case 2 If $but_aan_uit = 'uit' Then GUICtrlSetImage($b2, "C:\s0.bmp") Else GUICtrlSetImage($b2, "C:\s1.bmp") EndIf Case 3 If $but_aan_uit = 'uit' Then GUICtrlSetImage($b3, "C:\x0.bmp") Else GUICtrlSetImage($b3, "C:\x1.bmp") EndIf EndSwitch EndFunc ;==>buttonset ;################################################################################################; Func refrech() Dim $hWnd = WinGetHandle('[CLASS:Progman]') _SendMessage($hWnd, $WM_COMMAND, 0x0001A220) $WinExpListArr = _ExplWinGetList() If IsArray($WinExpListArr) Then For $iWin = 1 To $WinExpListArr[0] $GetWinState = WinGetState($WinExpListArr[$iWin]) $hWnd = WinGetHandle($WinExpListArr[$iWin]) DllCall("user32.dll", "long", "SendMessage", "hwnd", $hWnd, "int", 0x111, "int", 28931, "int", 0) Next EndIf Opt("WinTitleMatchMode", 4) $hWnd = WinGetHandle("classname=Progman") DllCall("user32.dll", "long", "SendMessage", "hwnd", $hWnd, "int", 0x111, "int", 28931, "int", 0) EndFunc ;==>refrech Func _ExplWinGetList() Opt("WinTitleMatchMode", 4) $WinList = WinList("classname=CabinetWClass") If IsArray($WinList) Then Local $WinListArr[$WinList[0][0] + 1] For $iW = 1 To $WinList[0][0] $WinListArr[$iW] = $WinList[$iW][0] Next $WinListArr[0] = $WinList[0][0] Return $WinListArr Else Return "" EndIf EndFunc ;==>_ExplWinGetList ;################################################################################################; While True Switch GUIGetMsg() Case $GUI_EVENT_CLOSE,$STOP tik(1) quit() Case $MIN tik(0) GUISetState(@SW_MINIMIZE) Case $b1 tik(0) If $box1 = 'uit' Then RegWrite("HKCU\Software\Microsoft\Windows\CurrentVersion\Explorer\Advanced", "Hidden", "REG_DWORD", $hidden_reg_show) buttonset(1, 'aan') $box1 = 'aan' Else RegWrite("HKCU\Software\Microsoft\Windows\CurrentVersion\Explorer\Advanced", "Hidden", "REG_DWORD", $hidden_reg_hide) buttonset(1, 'uit') $box1 = 'uit' EndIf refrech() Case $b2 tik(0) If $box2 = 'uit' Then RegWrite("HKCU\Software\Microsoft\Windows\CurrentVersion\Explorer\Advanced", "ShowSuperHidden", "REG_DWORD", $supper_hidden_reg_show) buttonset(2, 'aan') $box2 = 'aan' If $box1 = "uit" Then $box1 = "aan" RegWrite("HKCU\Software\Microsoft\Windows\CurrentVersion\Explorer\Advanced", "Hidden", "REG_DWORD", $hidden_reg_show) buttonset(1, $box1) EndIf Else RegWrite("HKCU\Software\Microsoft\Windows\CurrentVersion\Explorer\Advanced", "ShowSuperHidden", "REG_DWORD", $supper_hidden_reg_hide) buttonset(2, 'uit') $box2 = 'uit' EndIf refrech() Case $b3 tik(0) If $box3 = 'uit' Then RegWrite("HKCU\Software\Microsoft\Windows\CurrentVersion\Explorer\Advanced", "HideFileExt", "REG_DWORD", $ext_reg_show) buttonset(3, 'aan') $box3 = 'aan' Else RegWrite("HKCU\Software\Microsoft\Windows\CurrentVersion\Explorer\Advanced", "HideFileExt", "REG_DWORD", $ext_reg_hide) buttonset(3, 'uit') $box3 = 'uit' EndIf refrech() Case $TRAY tik(0) GUISetState(@SW_HIDE) TraySetState() TraySetOnEvent ( -8, "formshow" ) Case $RESET tik(0) reset(1) EndSwitch WEnd Func formshow() tik(0) TraySetState(2) GUISetState(@SW_SHOW) EndFunc Func reset($byval) local $refbool = False if $box1 = 'aan' then if $byval = 1 then $box1 = 'uit' buttonset(1, 'uit') EndIf RegWrite("HKCU\Software\Microsoft\Windows\CurrentVersion\Explorer\Advanced", "Hidden", "REG_DWORD", $hidden_reg_hide) $refbool = True EndIf if $box2 = 'aan' then if $byval = 1 then $box2 = 'uit' buttonset(2, 'uit') EndIf RegWrite("HKCU\Software\Microsoft\Windows\CurrentVersion\Explorer\Advanced", "ShowSuperHidden", "REG_DWORD", $supper_hidden_reg_hide) $refbool = True EndIf if $box3 = 'aan' then if $byval = 1 then $box3 = 'uit' buttonset(3, 'uit') EndIf RegWrite("HKCU\Software\Microsoft\Windows\CurrentVersion\Explorer\Advanced", "HideFileExt", "REG_DWORD", $ext_reg_hide) $refbool = True EndIf if $refbool = True Then refrech() EndFunc func quit() Switch MsgBox(3+512+8192+32, "Close.", "Remember current settings?") Case 6 ;Yes GUISetState(@SW_HIDE) tik(1) Exit Case 7 ;No GUISetState(@SW_HIDE) tik(1) reset(0) Exit Case 2 ;Cancel tik(0) Return EndSwitch EndFunc