ileandros Posted February 28, 2012 Author Share Posted February 28, 2012 (edited) I am using a similar way but look what is my problem. Here ur setting the data at the end like this While 1 Switch GUIGetMsg() Case $GUI_EVENT_CLOSE Exit Case $cButton ; If there is a selection to delete If GUICtrlRead($cLabel) <> "" Then ; Which one is it $iIndex = _GUICtrlListBox_SelectString($cList, GUICtrlRead($cLabel)) ; Delete it _GUICtrlListBox_DeleteString($cList, $iIndex) ; Clear the label GUICtrlSetData($cLabel, "") EndIf EndSwitch WEnd This is how you set the data. GuiCtrlSetData($cLabel, "") This is a nice way but its only use when you want to clear the entire field. In my case i have more than 1 $cLabel added at my list and when i use it, it clears the filed and deletes everything. I want to make it delete the spesific $cLabel that is chosen/clicked in case i have more than 1 item added and not clear everything... Edited February 28, 2012 by ileandros I feel nothing.It feels great. Link to comment Share on other sites More sharing options...
ileandros Posted February 28, 2012 Author Share Posted February 28, 2012 I found the solution case $BtnRemove $Deleteitem = GUICtrlRead($ListBoxToExecute) If StringStripWS($Deleteitem, 8) Then GUICtrlSetData($ListBoxToExecute, $Deleteitem) $iSel = _GUICtrlListBox_GetCurSel($ListBoxToExecute) _GUICtrlListBox_DeleteString($ListBoxToExecute, $iSel) EndIf I feel nothing.It feels great. Link to comment Share on other sites More sharing options...
ileandros Posted February 29, 2012 Author Share Posted February 29, 2012 ileandros, You would need to use "*.log" as the mask and run it again for each separate extension. But if you use my RecFileListToArray UDF you can search for several extensions in one pass, as BrewManNH suggested above: $aArray = _RecFileListToArray($sPath, "*.exe;*.bat;*.au3", 1) And the UDF will also search within subfolders if you wish. M23 Is there a way to make ur command $aArray = _RecFileListToArray($sPath, "*.exe;*.bat;*.au3", 1) work with a checkbox??? I mean insteed of adding ("*.exe;*.bat;*.au3",) at the code can i make a checkbox for each of these and make the command check only these that are checked from the checkboxes?? I feel nothing.It feels great. Link to comment Share on other sites More sharing options...
BrewManNH Posted February 29, 2012 Share Posted February 29, 2012 Yes, you can create a GUI with check boxes that you can then read to see if checked, and add the filters to the list by using a variable instead of an absolute string. If I posted any code, assume that code was written using the latest release version unless stated otherwise. Also, if it doesn't work on XP I can't help with that because I don't have access to XP, and I'm not going to.Give a programmer the correct code and he can do his work for a day. Teach a programmer to debug and he can do his work for a lifetime - by Chirag GudeHow to ask questions the smart way! I hereby grant any person the right to use any code I post, that I am the original author of, on the autoitscript.com forums, unless I've specifically stated otherwise in the code or the thread post. If you do use my code all I ask, as a courtesy, is to make note of where you got it from. Back up and restore Windows user files _Array.au3 - Modified array functions that include support for 2D arrays.  -  ColorChooser - An add-on for SciTE that pops up a color dialog so you can select and paste a color code into a script.  -  Customizable Splashscreen GUI w/Progress Bar - Create a custom "splash screen" GUI with a progress bar and custom label.  -  _FileGetProperty - Retrieve the properties of a file  -  SciTE Toolbar - A toolbar demo for use with the SciTE editor  -  GUIRegisterMsg demo - Demo script to show how to use the Windows messages to interact with controls and your GUI.  -   Latin Square password generator Link to comment Share on other sites More sharing options...
ileandros Posted February 29, 2012 Author Share Posted February 29, 2012 Yes that is true for the checkboxes but how can i check it?? i did it like this If GuiCtrlRead($checkbo1) = True Then ......... But i couldnt manage to add it at Melba23s' I feel nothing.It feels great. Link to comment Share on other sites More sharing options...
Moderators Melba23 Posted February 29, 2012 Moderators Share Posted February 29, 2012 ileandros,Something like this perhaps? expandcollapse popup#include <GUIConstantsEx.au3> Global $aCheck[3] $hGUI = GUICreate("Test", 500, 500) $aCheck[0] = GUICtrlCreateCheckbox("*.bat", 10, 10, 100, 20) $aCheck[1] = GUICtrlCreateCheckbox("*.exe", 10, 30, 100, 20) $aCheck[2] = GUICtrlCreateCheckbox("*.au3", 10, 50, 100, 20) $cButton = GUICtrlCreateButton("Go", 10, 100, 80, 30) GUISetState() While 1 Switch GUIGetMsg() Case $GUI_EVENT_CLOSE Exit Case $cButton $sExt_String = "" For $i = 0 To 2 If GUICtrlRead($aCheck[$i]) = 1 Then ; Add the type to the string wit the delimiter $sExt_String &= GUICtrlRead($aCheck[$i], 1) & ";" EndIf Next If $sExt_String <> "" Then ; Remove the final ; $sExt_String = StringTrimRight($sExt_String, 1) EndIf MsgBox(0, "And you get....", $sExt_String) EndSwitch WEndThen you can use that string in the _RecFileListToArray call. 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...
ileandros Posted February 29, 2012 Author Share Posted February 29, 2012 I dont know why the heck but i dont get it. This is how i had it working before. Case $fileitem1 GUICtrlSetData($ListProg, "") $sPath = StringReplace(@TempDir, " ", "") $aFiles = _RecFileListToArray($sPath, " *.* ", 1) For $i = 1 To $aFiles[0] GUICtrlSetData($ListProg, $aFiles[$i]) Next When i add ur script i have to empty this part right??? $aFiles = _RecFileListToArray($sPath, " EMPTY ", 1) so the type can be chosen from the checkbox but i got error when i have it EMPTY :/ I feel nothing.It feels great. Link to comment Share on other sites More sharing options...
Moderators Melba23 Posted February 29, 2012 Moderators Share Posted February 29, 2012 ileandros, So set a default value of *.* if no checkboxes are ticked: expandcollapse popup#include <GUIConstantsEx.au3> Global $aCheck[3] $hGUI = GUICreate("Test", 500, 500) GUICtrlCreateLabel("Select extension (Default = *.*)", 10, 10, 200, 20) $aCheck[0] = GUICtrlCreateCheckbox("*.bat", 10, 50, 100, 20) $aCheck[1] = GUICtrlCreateCheckbox("*.exe", 10, 70, 100, 20) $aCheck[2] = GUICtrlCreateCheckbox("*.au3", 10, 90, 100, 20) $cButton = GUICtrlCreateButton("Go", 10, 200, 80, 30) GUISetState() While 1 Switch GUIGetMsg() Case $GUI_EVENT_CLOSE Exit Case $cButton $sExt_String = "" For $i = 0 To 2 If GUICtrlRead($aCheck[$i]) = 1 Then ; Add the type to the string wit the delimiter $sExt_String &= GUICtrlRead($aCheck[$i], 1) & ";" EndIf Next If $sExt_String <> "" Then ; Remove the final ; $sExt_String = StringTrimRight($sExt_String, 1) Else ; Set default if empty $sExt_String = "*.*" ; <<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<< EndIf MsgBox(0, "And you get....", $sExt_String) EndSwitch WEnd 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...
ileandros Posted February 29, 2012 Author Share Posted February 29, 2012 puta!!!!!!!!!!!!!! The problem is that it doesn't work. For me at least. The problem is that when i use the @TempDir nagivate it is set to *.exe because i cant have it empty since i have an error. and when checkbox is ticked it doesnt navigate for the checkbox only for the .exe How can i combine mine with ur to make it damn work ??? I feel nothing.It feels great. Link to comment Share on other sites More sharing options...
Moderators Melba23 Posted February 29, 2012 Moderators Share Posted February 29, 2012 ileandros, Perhaps like this? expandcollapse popup#include <GUIConstantsEx.au3> #include <Array.au3> #include <RecFileListToArray.au3> Global $aCheck[3] $hGUI = GUICreate("Test", 500, 500) GUICtrlCreateLabel("Select extension (Default = *.*)", 10, 10, 200, 20) $aCheck[0] = GUICtrlCreateCheckbox("*.bat", 10, 50, 100, 20) $aCheck[1] = GUICtrlCreateCheckbox("*.exe", 10, 70, 100, 20) $aCheck[2] = GUICtrlCreateCheckbox("*.au3", 10, 90, 100, 20) $cButton = GUICtrlCreateButton("Go", 10, 200, 80, 30) GUISetState() While 1 Switch GUIGetMsg() Case $GUI_EVENT_CLOSE Exit Case $cButton $sExt_String = "" For $i = 0 To 2 If GUICtrlRead($aCheck[$i]) = 1 Then ; Add the type to the string with the delimiter $sExt_String &= GUICtrlRead($aCheck[$i], 1) & ";" EndIf Next If $sExt_String <> "" Then ; Remove the final ; $sExt_String = StringTrimRight($sExt_String, 1) Else ; Set default if empty $sExt_String = "*.*" EndIf ; This is what we are looking for MsgBox(0, "Searching for...", $sExt_String) $sPath = StringReplace(@TempDir, " ", "") $aFiles = _RecFileListToArray($sPath, $sExt_String, 1) ; And this is what we found If @error Then MsgBox(0, "Ooops!", "No files found in " & $sPath) Else _ArrayDisplay($aFiles, $sPath) EndIf EndSwitch WEnd M23 P.S. Are you actually going to write part of this script at some point in the process or am I going to do it all?  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...
Moderators JLogan3o13 Posted February 29, 2012 Moderators Share Posted February 29, 2012 P.S. Are you actually going to write part of this script at some point in the process or am I going to do it all? I do believe you qualify as a rent-a-coder after 15 answers "Profanity is the last vestige of the feeble mind. For the man who cannot express himself forcibly through intellect must do so through shock and awe" - Spencer W. Kimball How to get your question answered on this forum! Link to comment Share on other sites More sharing options...
ileandros Posted February 29, 2012 Author Share Posted February 29, 2012 I did a similar before but i dont know how to set it at the listbox after. You display it with an array i want to display it at my listbox $list1 but i cant. Thats why im getting errors im trying different ways :/ I feel nothing.It feels great. Link to comment Share on other sites More sharing options...
Moderators Melba23 Posted March 1, 2012 Moderators Share Posted March 1, 2012 ileandros, We have discussed how to get elements from an array into a list before - and you have even posted the code yourself in your post #47 above: $aFiles = _RecFileListToArray($sPath, " *.* ", 1) For $i = 1 To $aFiles[0] GUICtrlSetData($ListProg, $aFiles[$i]) Next 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...
ileandros Posted March 1, 2012 Author Share Posted March 1, 2012 (edited) YES!!!!!!!!!!!!!!!!!! I made it work. It has to be like this! Case $fileitem1 $sExt_String = "" For $i = 0 To 1 If GUICtrlRead($aCheck[$i]) = 1 Then ; Add the type to the string with the delimiter $sExt_String &= GUICtrlRead($aCheck[$i], 1) & ";" EndIf Next If $sExt_String <> "" Then ; Remove the final ; $sExt_String = StringTrimRight($sExt_String, 1) Else ; Set default if empty $sExt_String = "*.*" EndIf ; This is what we are looking for MsgBox(0, "Searching for...", $sExt_String) $sPath = StringReplace(@TempDir, " ", "") $aFiles = _RecFileListToArray($sPath, $sExt_String, 1) For $i = 1 To $aFiles[0] GUICtrlSetData($List1, $aFiles[$i]) Next ; And this is what we found If @error Then MsgBox(0, "Ooops!", "No files found in " & $sPath) EndIf You made it work (Melba23) Edit: i got an error. If the chosen type of files doesn't exists i dont get this that is supposed to do If @error Then MsgBox(0, "Ooops!", "No files found in " & $sPath) EndIf but i get this error message C:Program Filesoffice.au3officeNew.au3 (107) : ==> Subscript used with non-Array variable.: For $i = 1 To $aFiles[0] For $i = 1 To $aFiles^ ERROR ->19:27:09 AutoIT3.exe ended.rc:1 >Exit code: 1 Time: 7.994 Edited March 1, 2012 by ileandros I feel nothing.It feels great. 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