BrewManNH Posted February 22, 2012 Posted February 22, 2012 You can't filter the file list very well with _FIleListToArray because it only accepts one filename and/or extension to look for (using wildcards), you'd need to use something like Melba23's _RecFileListToArray and put in every type of file you want to look for, such as *.exe, *.bat, *.au3 etc. 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
ileandros Posted February 22, 2012 Author Posted February 22, 2012 Ok thank you all for your BIG help I feel nothing.It feels great.
ileandros Posted February 22, 2012 Author Posted February 22, 2012 (edited) Melba23 you helped me and you gave me this code $sPath = StringReplace(@DesktopDir, "AutoIt3.exe", "") $aFiles = _FileListToArray($sPath, "*.*", 1) For $i = 1 To $aFiles[0] GUICtrlSetData($List1, $aFiles[$i]) Next If i change this is it possible to make it load spesific kind of files??? $aFiles = _FileListToArray($sPath, ".log", 1) or whatever files img, txt etc.. Edited February 22, 2012 by ileandros I feel nothing.It feels great.
Moderators Melba23 Posted February 22, 2012 Moderators Posted February 22, 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 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
ileandros Posted February 22, 2012 Author Posted February 22, 2012 yes but i got the same error as the one commented on you. I cant read the #include "RecFileListToArray" I feel nothing.It feels great.
Moderators Melba23 Posted February 22, 2012 Moderators Posted February 22, 2012 ileandros, Have you downloaded the UDF and put in the same folder as the script? 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
ileandros Posted February 22, 2012 Author Posted February 22, 2012 yes I feel nothing.It feels great.
Moderators Melba23 Posted February 22, 2012 Moderators Posted February 22, 2012 (edited) ileandros,So what exactly is the "error" you get? M23Edit: You need #include "RecFileListToArray.au3" - does that help? Edited February 22, 2012 by Melba23 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
ileandros Posted February 22, 2012 Author Posted February 22, 2012 yes i did it but i had some other error besides that. I corrected all the errors the only prob now that it doesnt load any files... I feel nothing.It feels great.
ileandros Posted February 22, 2012 Author Posted February 22, 2012 ahhh fixed it. I used ur method but with the code ur giving above it only read .exe why not the others since they are in the code??? I feel nothing.It feels great.
ileandros Posted February 22, 2012 Author Posted February 22, 2012 Fixed that too Why ate the 2 first there is ; and tha the last (au3) there is not??? I feel nothing.It feels great.
Moderators Melba23 Posted February 23, 2012 Moderators Posted February 23, 2012 ileandros,I have no idea - do you have files with all 3 extensions in the folder you are searching? As usual in your threads I find I have to ask you to post the code you have been using - please help us to help you. 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
ileandros Posted February 24, 2012 Author Posted February 24, 2012 (edited) No i have no problems i made it work I just asked why there is this ( after the exe and bat $aArray = _RecFileListToArray($sPath, "*.exe;*.bat;*.au3", 1) in ur method. Just a question for information nothing more. Edited February 24, 2012 by ileandros I feel nothing.It feels great.
Moderators Melba23 Posted February 24, 2012 Moderators Posted February 24, 2012 ileandros, I understand now - I added the .au3 because BrewManNH had used those 3 extensions in his post at the top of the page. 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
ileandros Posted February 24, 2012 Author Posted February 24, 2012 (edited) ( = ( , ; , ) i am asking why this ; exist at exe and bat and not at the au3???? P.S. this is the control to set the state of something GUICtrlRead($test) GUICtrlSetData($test, $test1) What the heck is the command to undothat. i dont mean this GUICtrlRead($test) GUICtrlSetData($test, " " ) I mean to remove 1 item not to clear the $test state Edited February 24, 2012 by ileandros I feel nothing.It feels great.
BrewManNH Posted February 24, 2012 Posted February 24, 2012 The ";" is used to separate the filters, because .au3 is the last one in the list, there's nothing needed to separate it from anything else. 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
Moderators Melba23 Posted February 24, 2012 Moderators Posted February 24, 2012 ileandros,Obviously I did not understand - but neither did you read the function header for _RecFileListToArray where it clearly states:$sInclude_List - Optional: filter for included results (default "*"). Multiple filters must be separated by ";"So I reckon we are even at worst. For your next question - what do you mean by "remove 1 item"? Do you mean delete the control entirely? If so then GUICtrlDelete is what you are looking for. If not, then please explain in slightly less cryptic terms. I realise English is not your first language, but it woudl help us help you if you explained your problems in a bit more detail when you post. A few words and a couple of lines of code is often not enough to let us guess what you are actually looking for - as evidenced by many of the earlier posts in this thread. 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
kylomas Posted February 24, 2012 Posted February 24, 2012 ileandros, IF you want to handle populating controls with GuiCtrlSetData than you need to manipulate the variable "$test1" and re-populate the control "$test" at every change. kylomas Forum Rules Procedure for posting code "I like pigs. Dogs look up to us. Cats look down on us. Pigs treat us as equals." - Sir Winston Churchill
ileandros Posted February 25, 2012 Author Posted February 25, 2012 Well i set the data of a list with GuiCtrlSetData. Which means i fill a list with items. I want to know how t remone items from the list. How to delete. Which is the commamd to do that...? I wad looking at the help files but didnt manage to find it. And sorry for my english. Im good but i type quick and i talk simple I feel nothing.It feels great.
Moderators Melba23 Posted February 25, 2012 Moderators Posted February 25, 2012 ileandros,Now you have explained what you want - here is how you might do it: expandcollapse popup#include <GUIConstantsEx.au3> #include <WindowsConstants.au3> #include <ListBoxConstants.au3> #include <GuiListBox.au3> #include <File.au3> ; Get the path of the AutoIt exe $sPath = StringReplace(@AutoItExe, "AutoIt3.exe", "") ; Read all the files on that path into an array $aFiles = _FileListToArray($sPath, "*.*", 1) ; Create a GUI $hGUI = GUICreate("Test", 500, 500) ; Create a list $cList = GUICtrlCreateList("", 10, 10, 200, 200) ; And fill it with our data For $i = 1 To $aFiles[0] GUICtrlSetData($cList, $aFiles[$i]) Next ; Create a button and label $cButton = GUICtrlCreateButton("Delete", 10, 300, 80, 30) $cLabel = GUICtrlCreateLabel("", 100, 310, 200, 20) GUISetState() ; Look for doubleclicks on the list GUIRegisterMsg($WM_COMMAND, "_WM_COMMAND") While 1 Switch GUIGetMsg() Case $GUI_EVENT_CLOSE Exit Case $cButton ; If there is a selection to delete If GUICtrlRead($cLabel) <> "" ; Which one is it $iIndex = _GUICtrlListBox_SelectString($cList, GUICtrlRead($cLabel)) ; Delete it _GUICtrlListBox_DeleteString($cList, $iIndex) ; Clear the label GUICtrlSetData($cLabel, "") EndIf EndSwitch WEnd Func _WM_COMMAND($hWnd, $msg, $wParam, $lParam) Local $nCode = BitShift($wParam, 16) ; HiWord Local $nIDFrom = BitAND($wParam, 0xFFFF) ; LoWord Switch $nIDFrom ; If from the list Case $cList Switch $nCode ; If a double click Case $LBN_DBLCLK ; Read selected item $sListItem = GUICtrlRead($cList) ; Display selected item GUICtrlSetData($cLabel, $sListItem) EndSwitch EndSwitch Return $GUI_RUNDEFMSG EndFunc ;==>_WM_COMMANDAs I have said to you many times before - help us to help you. Take the time to explain the problem you are having, perhaps even write a small reproducer script. A couple of cryptic remarks and a few lines of code do not allow us to do much other than offer guesses or simply ask for a better explanation. Many of the posts in this thread are only there because we needed to drag more information out of you - my typing fingers and keyboard would be grateful for more explanation from you initially. OK? 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
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