Quantcast
Channel: AutoIt v3 - General Help and Support
Viewing all articles
Browse latest Browse all 12506

find hidden files and check a checkbox

$
0
0
hello, i don't know what is wrong with my code, i'm trying to find hidden files in a directory and if exist at least one hidden file check a checkbox, here's my code

[ autoit ]         
#Include <GUIConstantsEx.au3> #include <GuiComboBox.au3> Local $msg GUICreate("My GUI") ; will create a dialog box that when displayed is centered $Combo = GUICtrlCreateCombo("c:\test", 20, 20, 200, 20, $CBS_DROPDOWNLIST) GUICtrlSetData(-1, "c:\test2|c:\test3", "c:\test3") $ShowHiddenFiles = GUICtrlCreateCheckbox("Show hidden files", 10, 50, 100, 20) GUISetState(@SW_SHOW) ; will display an empty dialog box ; Run the GUI until the dialog is closed While 1 Global $Path = GUICtrlRead($Combo) DetectHiddenFiles() $msg = GUIGetMsg() If $msg = $GUI_EVENT_CLOSE Then ExitLoop WEnd GUIDelete() Func DetectHiddenFiles() If GUICtrlRead($ShowHiddenFiles) = 4 Then ;if the checkbox is unchecked $path = GUICtrlRead($Combo) & "\*." $handle = FileFindFirstFile($Path) While 1 $file = FileFindNextFile($handle) If @error Then ExitLoop $attrib = FileGetAttrib($Path & "\" & $file) If StringInStr($attrib, "H") = 1 Then If GUICtrlRead($ShowHiddenFiles) = 4 Then ;if is disabled GUICtrlSetState($ShowHiddenFiles, $GUI_CHECKED) ExitLoop EndIf EndIf WEnd FileClose($handle) EndIf EndFunc ;==>FindHiddenDirs

Viewing all articles
Browse latest Browse all 12506

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>