Sign in to follow this  
Followers 0
MrCreatoR

Folders Update

3 posts in this topic

Hi to All!

I want to write registry entry, that hide files extensions. But to apply the changes, it is necessary to update (refresh) all opened folders. Sending F5 not help, now i use this method (not exactly effective when currently opened big number of folders) :

$DeskNotActive = 0
$ReadHideFileExt = RegRead("HKEY_CURRENT_USER\Software\Microsoft\Windows\CurrentVersion\Explorer\Advanced", "HideFileExt")

If $ReadHideFileExt = 1 Then
    RegWrite("HKEY_CURRENT_USER\Software\Microsoft\Windows\CurrentVersion\Explorer\Advanced", "HideFileExt", "REG_DWORD", 0)
Else
    RegWrite("HKEY_CURRENT_USER\Software\Microsoft\Windows\CurrentVersion\Explorer\Advanced", "HideFileExt", "REG_DWORD", 1)
EndIf

UpdateExplorer()

Func UpdateExplorer()
    Opt("WinTitleMatchMode", 4)
    $PropsTitle = "classname=#32770"
    Run("RunDll32.exe shell32.dll,Options_RunDLL 0")
    WinWait($PropsTitle, "", 15)
    ControlCommand($PropsTitle, "", "SysTabControl321", "TabRight", "")
    Sleep(200)
    ControlClick($PropsTitle, "", "Button5")
    $WinExpListArr = _ExplWinGetList()
    If IsArray($WinExpListArr) Then
        $ActiveWindow = $WinExpListArr[1]
        For $iWin = 1 To $WinExpListArr[0]
            $GetWinState = WinGetState($WinExpListArr[$iWin])
            WinActivate($WinExpListArr[$iWin])
            WinWaitActive($WinExpListArr[$iWin], "", 10)
            Send("{F5}")
            If $GetWinState = 23 Then WinSetState($WinExpListArr[$iWin], "", @SW_MINIMIZE)
        Next
        WinActivate($ActiveWindow)
    EndIf

    If Not WinActive("classname=Progman") Then
        $DeskNotActive = 1
        WinMinimizeAll()
        Sleep(300)
    EndIf
    Send("{F5}")
    If $DeskNotActive = 1 Then WinMinimizeAllUndo()
EndFunc

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

Maby there is another way to do this? :whistle:


Using OS: Win 7 Professional, Using AutoIt Ver(s): 3.3.6.1 / 3.3.8.1

AutoIt_Rus_Community.png AutoIt Russian Community

My Work...

AutoIt_Icon_small.pngProjects: ATT - Application Translate Tool {new}| BlockIt - Block files & folders {new}| SIP - Selected Image Preview {new}| SISCABMAN - SciTE Abbreviations Manager {new}| AutoIt Path Switcher | AutoIt Menu for Opera! | YouTube Download Center! | Desktop Icons Restorator | Math Tasks | KeyBoard & Mouse Cleaner | CaptureIt - Capture Images Utility | CheckFileSize Program

AutoIt_Icon_small.pngUDFs: OnAutoItErrorRegister - Handle AutoIt critical errors {new}| AutoIt Syntax Highlight {new}| Opera Library! | Winamp Library | GetFolderToMenu | Custom_InputBox()! | _FileRun UDF | _CheckInput() UDF | _GUIInputSetOnlyNumbers() UDF | _FileGetValidName() UDF | _GUICtrlCreateRadioCBox UDF | _GuiCreateGrid() | _PathSplitByRegExp() | _GUICtrlListView_MoveItems - UDF | GUICtrlSetOnHover_UDF! | _ControlTab UDF! | _MouseSetOnEvent() UDF! | _ProcessListEx - UDF | GUICtrl_SetResizing - UDF! | Mod. for _IniString UDFs | _StringStripChars UDF | _ColorIsDarkShade UDF | _ColorConvertValue UDF | _GUICtrlTab_CoverBackground | CUI_App_UDF | _IncludeScripts UDF | _AutoIt3ExecuteCode | _DragList UDF | Mod. for _ListView_Progress | _ListView_SysLink | _GenerateRandomNumbers | _BlockInputEx | _IsPressedEx | OnAutoItExit Handler | _GUICtrlCreateTFLabel UDF | WinControlSetEvent UDF | Mod. for _DirGetSizeEx UDF
 
AutoIt_Icon_small.pngExamples: 
ScreenSaver Demo - Matrix included | Gui Drag Without pause the script | _WinAttach()! | Turn Off/On Monitor | ComboBox Handler Example | Mod. for "Thinking Box" | Cool "About" Box | TasksBar Imitation Demo

Like the Projects/UDFs/Examples? Please rate the topic (up-right corner of the post header: Rating AutoIt_Rating.gif)

* === My topics === *

==================================================
My_Userbar.gif
==================================================

AutoIt is simple, subtle, elegant. © AutoIt Team

Share this post


Link to post
Share on other sites



Maybe some system broadcast message. I don't know exactly, but for example after resolution change is sent system broadcast message. So maybe there is also some similar broadcast message also for your registry purpose.

See HWND_BROADCAST & WM_DISPLAYCHANGE:

Func DisplayChangeRes($WIDTH, $HEIGHT, $BPP, $FREQ)
    $DM_PELSWIDTH = 0x00080000
    $DM_PELSHEIGHT = 0x00100000
    $DM_BITSPERPEL = 0x00040000
    $DM_DISPLAYFREQUENCY = 0x00400000
    $CDS_TEST = 0x00000002
    $CDS_UPDATEREGISTRY = 0x00000001
    $DISP_CHANGE_RESTART = 1
    $DISP_CHANGE_SUCCESSFUL = 0
    $HWND_BROADCAST = 0xffff
    $WM_DISPLAYCHANGE = 0x007E
    
    $DEVMODE = DLLStructCreate ("byte[32];int[10];byte[32];int[6]")
    $B = DllCall("user32.dll", "int", "EnumDisplaySettings", "ptr", 0, "long", 0, "ptr", DLLStructGetPtr ($DEVMODE))
    If @error Then
        $B = 0
    Else
        $B = $B[0]
    EndIf
    
    If $B <> 0 Then
        DllStructSetData ($DEVMODE, 2, BitOR($DM_PELSWIDTH, $DM_PELSHEIGHT, $DM_BITSPERPEL, $DM_DISPLAYFREQUENCY), 5)
        DllStructSetData ($DEVMODE, 4, $WIDTH, 2)
        DllStructSetData ($DEVMODE, 4, $HEIGHT, 3)
        DllStructSetData ($DEVMODE, 4, $BPP, 1)
        DllStructSetData ($DEVMODE, 4, $FREQ, 5)
        $B = DllCall("user32.dll", "int", "ChangeDisplaySettings", "ptr", DLLStructGetPtr ($DEVMODE), "int", $CDS_TEST)
        If @error Then
            $B = -1
        Else
            $B = $B[0]
        EndIf
        
        Select
            Case $B = $DISP_CHANGE_RESTART
                $DEVMODE = ""
                Return 2
            Case $B = $DISP_CHANGE_SUCCESSFUL
                DllCall("user32.dll", "int", "ChangeDisplaySettings", "ptr", DLLStructGetPtr ($DEVMODE), "int", $CDS_UPDATEREGISTRY)
                DllCall("user32.dll", "int", "SendMessage", "hwnd", $HWND_BROADCAST, "int", $WM_DISPLAYCHANGE, _
                        "int", $BPP, "int", $HEIGHT * 2 ^ 16 + $WIDTH)
                $DEVMODE = ""
                Return 1
            Case Else
                $DEVMODE = ""
                Return $B
        EndSelect
    EndIf
EndFunc ;==>DisplayChangeRes

Share this post


Link to post
Share on other sites

Zedna

Thanx! the solution is here


Using OS: Win 7 Professional, Using AutoIt Ver(s): 3.3.6.1 / 3.3.8.1

AutoIt_Rus_Community.png AutoIt Russian Community

My Work...

AutoIt_Icon_small.pngProjects: ATT - Application Translate Tool {new}| BlockIt - Block files & folders {new}| SIP - Selected Image Preview {new}| SISCABMAN - SciTE Abbreviations Manager {new}| AutoIt Path Switcher | AutoIt Menu for Opera! | YouTube Download Center! | Desktop Icons Restorator | Math Tasks | KeyBoard & Mouse Cleaner | CaptureIt - Capture Images Utility | CheckFileSize Program

AutoIt_Icon_small.pngUDFs: OnAutoItErrorRegister - Handle AutoIt critical errors {new}| AutoIt Syntax Highlight {new}| Opera Library! | Winamp Library | GetFolderToMenu | Custom_InputBox()! | _FileRun UDF | _CheckInput() UDF | _GUIInputSetOnlyNumbers() UDF | _FileGetValidName() UDF | _GUICtrlCreateRadioCBox UDF | _GuiCreateGrid() | _PathSplitByRegExp() | _GUICtrlListView_MoveItems - UDF | GUICtrlSetOnHover_UDF! | _ControlTab UDF! | _MouseSetOnEvent() UDF! | _ProcessListEx - UDF | GUICtrl_SetResizing - UDF! | Mod. for _IniString UDFs | _StringStripChars UDF | _ColorIsDarkShade UDF | _ColorConvertValue UDF | _GUICtrlTab_CoverBackground | CUI_App_UDF | _IncludeScripts UDF | _AutoIt3ExecuteCode | _DragList UDF | Mod. for _ListView_Progress | _ListView_SysLink | _GenerateRandomNumbers | _BlockInputEx | _IsPressedEx | OnAutoItExit Handler | _GUICtrlCreateTFLabel UDF | WinControlSetEvent UDF | Mod. for _DirGetSizeEx UDF
 
AutoIt_Icon_small.pngExamples: 
ScreenSaver Demo - Matrix included | Gui Drag Without pause the script | _WinAttach()! | Turn Off/On Monitor | ComboBox Handler Example | Mod. for "Thinking Box" | Cool "About" Box | TasksBar Imitation Demo

Like the Projects/UDFs/Examples? Please rate the topic (up-right corner of the post header: Rating AutoIt_Rating.gif)

* === My topics === *

==================================================
My_Userbar.gif
==================================================

AutoIt is simple, subtle, elegant. © AutoIt Team

Share this post


Link to post
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
Sign in to follow this  
Followers 0