fxdave Posted August 10, 2012 Share Posted August 10, 2012 Hi, I am David Biro, from Hungary. I'm written a script: #include <file.au3> #include <array.au3> Local $main_cats = _FileListToArray("system_cats/") for $main_cat in $main_cats Local $cats = _FileListToArray("system_cats/" & $main_cat & "/") for $cat in $cats Local $programs = _FileListToArray("system_cats/" & $main_cat & "/" & $cat & "/") for $program in $programs Next Next Next And I got an error: for $program in $programs for $program in $programs^ ERROR I think the code is correct. It's bug? Link to comment Share on other sites More sharing options...
Moderators Melba23 Posted August 10, 2012 Moderators Share Posted August 10, 2012 (edited) fxdave,Welcome to the AutoIt forum. The is no bug. You are asking _FileListToArray to return both files and folders - that is its default setting. So you might well then be asking the function to look for files and folders inside files - which means you do not get a array returned and so AutoIt announces an error. Try getting the function to return only folders - or check if the return is a folder - before getting it to look for files in the inner loop. And in any case you need some errorchecking to cater for the event that the function does not return an array - and that the element is a valid path because the UDF returns a count in the [0] element. Personally I would go for the other type of For and just loop through the arrays that way. M23 Edited August 10, 2012 by Melba23 Typo 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...
jdelaney Posted August 10, 2012 Share Posted August 10, 2012 Do some error handling, to ensure the _FileListToArray returns an array (success) If IsArray($programs) Then ... EndIf IEbyXPATH-Grab IE DOM objects by XPATH IEscriptRecord-Makings of an IE script recorder ExcelFromXML-Create Excel docs without excel installed GetAllWindowControls-Output all control data on a given window. Link to comment Share on other sites More sharing options...
fxdave Posted August 10, 2012 Author Share Posted August 10, 2012 really! I forgot ... Sorry for the new topic. thanks for all! 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