behdadsoft Posted January 20, 2014 Posted January 20, 2014 Hi. I want get all files name in MyFolder and store them at text file. I wrote this code but don't work. Please Guide Me. Local $aFileList = _FileListToArray ( @DesktopDir & "\MyFolder", "*", 0 ) Local $FileOpen = FileOpen (@ScriptDir & "\list.txt", 1) FileWrite ($FileOpen, $aFileList)
Moderators Melba23 Posted January 20, 2014 Moderators Posted January 20, 2014 (edited) behdadsoft,Which version of AutoIt are you running? There was a script-breaking change to the _FileListToArray function in 3.3.11.3 and the syntax you are using there is only valid for that version.Other than that, you cannot write an array directly to a file in that manner - use the _FileWriteFromArray function to do it. M23Edit: Got my functions mixed - no problem with _FileListToArray - it was _FileReadToArray that changed syntax. Edited January 20, 2014 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
behdadsoft Posted January 20, 2014 Author Posted January 20, 2014 (edited) I use ver 3.3.6. Thanks I Fixed with _FileWriteFromArray. But I want add All get names in " ". how can do it? e.g : "name 1" "name 2" . . . . Edited January 20, 2014 by behdadsoft
Moderators Melba23 Posted January 20, 2014 Moderators Posted January 20, 2014 behdadsoft,Do you mean you want to return only the files beginning with a certain name? If so then you do it by using a willdcard like this: Local $aFileList = _FileListToArray ( @DesktopDir & "\MyFolder", "name*.*", 0 )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
behdadsoft Posted January 20, 2014 Author Posted January 20, 2014 Do you mean you want to return only the files beginning with a certain name? No I want all name put in Two double quotes (" "). "name1" "name2" . . . . and so on.
michaelslamet Posted January 20, 2014 Posted January 20, 2014 (edited) No I want all name put in Two double quotes (" "). "name1" "name2" . . . . and so on. For $a = 0 to Ubound($aFileList)-1 $aNewArray[$a] = '"' & $aFileList[$a] & '"' Next Edited January 20, 2014 by michaelslamet
Moderators Melba23 Posted January 20, 2014 Moderators Posted January 20, 2014 behdadsoft,Then you need to loop through the array and add the quotes before saving it to file: Local $aFileList = _FileListToArray ( @DesktopDir & "\MyFolder", "*", 0 ) For $i = 1 To $aFileList[0] ; Add leading and trailing quotes $aFileList[$i] = '"' & $aFileList[$i] & '"' Next _FileWriteFromArray(...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
behdadsoft Posted January 20, 2014 Author Posted January 20, 2014 Thanks michaelslamet Thanks Melba23, Now work very well.
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