price98 Posted September 10, 2018 Share Posted September 10, 2018 Hi, I have different files . For example, I have to two check boxes, one for text files and another one for pdf files. If i select text file check box then list of files has to shown . Can anyone help me ? Thanks #include <File.au3> Local $aFileList Local $hGui = GUICreate("ProgramData", 450, 300) Local $hButton = GUICtrlCreateCheckbox("File list", 144, 32, 97, 17) Local $hList = GUICtrlCreateList("", 10, 100, 430, 200) GUISetState(@SW_SHOW) While True $sMsg = GUIGetMsg() Switch $sMsg Case -3 Exit Case $hButton $aFileList = _FileListToArray(@DesktopDir, "*") ; add your path here For $i = 0 To UBound($aFileList) -1 GUICtrlSetData($hList, $aFileList[$i]) Next EndSwitch Sleep(100) WEnd Link to comment Share on other sites More sharing options...
Moderators Melba23 Posted September 10, 2018 Moderators Share Posted September 10, 2018 price98, Why hijack an unrelated thread from several years ago? Why not start a new one as I have now done for you? And although you say you have two checkboxes, your code has only one - which seems to work as it produces a list of files on the desktop when selected. So what exactly is your problem? Why not just add a second checkbox? M23 Any of my own code posted anywhere on the forum is available for use by others without any restriction of any kind Open spoiler to see my UDFs: Spoiler ArrayMultiColSort ---- Sort arrays on multiple columnsChooseFileFolder ---- Single and multiple selections from specified path treeview listingDate_Time_Convert -- Easily convert date/time formats, including the language usedExtMsgBox --------- A highly customisable replacement for MsgBoxGUIExtender -------- Extend and retract multiple sections within a GUIGUIFrame ---------- Subdivide GUIs into many adjustable framesGUIListViewEx ------- Insert, delete, move, drag, sort, edit and colour ListView itemsGUITreeViewEx ------ Check/clear parent and child checkboxes in a TreeViewMarquee ----------- Scrolling tickertape GUIsNoFocusLines ------- Remove the dotted focus lines from buttons, sliders, radios and checkboxesNotify ------------- Small notifications on the edge of the displayScrollbars ----------Automatically sized scrollbars with a single commandStringSize ---------- Automatically size controls to fit textToast -------------- Small GUIs which pop out of the notification area Link to comment Share on other sites More sharing options...
price98 Posted September 10, 2018 Author Share Posted September 10, 2018 Melba 23, Sorry for that . I thought , I can continue there. I can add second checkbox, but i have to know how to separate two check boxes for two different file types ? Thanks Link to comment Share on other sites More sharing options...
Moderators Melba23 Posted September 10, 2018 Moderators Share Posted September 10, 2018 price98, Look at the _FileListToArray function in the Help file - what do you think the $sFilter parameter does? And if you want either text or pdf files, I would use radios - if you want either or both then stick with checkboxes. M23 P.S. I am happy to see you get help on listing the files - but the moment you ask about downloading them you are toast - clear? Any of my own code posted anywhere on the forum is available for use by others without any restriction of any kind Open spoiler to see my UDFs: Spoiler ArrayMultiColSort ---- Sort arrays on multiple columnsChooseFileFolder ---- Single and multiple selections from specified path treeview listingDate_Time_Convert -- Easily convert date/time formats, including the language usedExtMsgBox --------- A highly customisable replacement for MsgBoxGUIExtender -------- Extend and retract multiple sections within a GUIGUIFrame ---------- Subdivide GUIs into many adjustable framesGUIListViewEx ------- Insert, delete, move, drag, sort, edit and colour ListView itemsGUITreeViewEx ------ Check/clear parent and child checkboxes in a TreeViewMarquee ----------- Scrolling tickertape GUIsNoFocusLines ------- Remove the dotted focus lines from buttons, sliders, radios and checkboxesNotify ------------- Small notifications on the edge of the displayScrollbars ----------Automatically sized scrollbars with a single commandStringSize ---------- Automatically size controls to fit textToast -------------- Small GUIs which pop out of the notification area Link to comment Share on other sites More sharing options...
Zedna Posted September 10, 2018 Share Posted September 10, 2018 #include <GUIConstantsEx.au3> #include <File.au3> Local $aFileList Local $hGui = GUICreate("ProgramData", 450, 300) Local $hButton_txt = GUICtrlCreateCheckbox("File list TXT", 144, 32, 97, 17) Local $hButton_pdf = GUICtrlCreateCheckbox("File list PDF", 144, 62, 97, 17) Local $hList = GUICtrlCreateList("", 10, 100, 430, 200) GUISetState(@SW_SHOW) $aFileList = _FileListToArray(@DesktopDir, "*.*", 1) ; add your path here While True $sMsg = GUIGetMsg() Switch $sMsg Case -3 Exit Case $hButton_txt, $hButton_pdf $want_txt = IsChecked($hButton_txt) $want_pdf = IsChecked($hButton_pdf) GUICtrlSetData($hList, '') If $want_txt Or $want_pdf Then For $i = 1 To UBound($aFileList) - 1 If ($want_txt And StringLower(StringRight($aFileList[$i],4)) == '.txt') Or _ ($want_pdf And StringLower(StringRight($aFileList[$i],4)) == '.pdf') Then GUICtrlSetData($hList, $aFileList[$i]) EndIf Next EndIf EndSwitch WEnd Func IsChecked($control) Return BitAnd(GUICtrlRead($control),$GUI_CHECKED) = $GUI_CHECKED EndFunc price98 1 Resources UDF ResourcesEx UDF AutoIt Forum Search Link to comment Share on other sites More sharing options...
price98 Posted September 10, 2018 Author Share Posted September 10, 2018 thanks @Zedna @Melba23 Link to comment Share on other sites More sharing options...
Zedna Posted September 10, 2018 Share Posted September 10, 2018 (edited) Little speed optimization in For/Next loop: For $i = 1 To UBound($aFileList) - 1 $ext = StringLower(StringRight($aFileList[$i],4)) If ($want_txt And $ext == '.txt') Or _ ($want_pdf And $ext == '.pdf') Then GUICtrlSetData($hList, $aFileList[$i]) EndIf Next Edited September 10, 2018 by Zedna price98 1 Resources UDF ResourcesEx UDF AutoIt Forum Search Link to comment Share on other sites More sharing options...
price98 Posted September 11, 2018 Author Share Posted September 11, 2018 (edited) hi, I do not know this is the right thread to ask this question. In Microsoft access, I created the database as shown below figure.In autoit, I have to create check boxes named as Controller,Simulator,Testing (as shown in figure). Suppose If I select testing check box then all related files to testing attribue has to shown in database. Can anyone give any idea ? Thanks Edited September 12, 2018 by price98 Link to comment Share on other sites More sharing options...
price98 Posted September 12, 2018 Author Share Posted September 12, 2018 Hi, I thought to open new thread to ask previous question.But , I am unable to deleting previous post. Can anyone help me ? Thanks Link to comment Share on other sites More sharing options...
Skeletor Posted September 12, 2018 Share Posted September 12, 2018 @price98 - Yes, Please start a new thread and add as much information as you possible can. Pictures will help as well. Don't forget to use the <> icon to add your code. Kind RegardsSkeletor "Coffee: my defense against going postal." Microsoft Office Splash Screen | Basic Notepad Program (Beginner) | Transparent Splash Screen | Full Screen UI Link to comment Share on other sites More sharing options...
Recommended Posts
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 accountSign in
Already have an account? Sign in here.
Sign In Now