Sign in to follow this  
Followers 0
behdadsoft

_FileListToArray

8 posts in this topic




#2 ·  Posted (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. :)

M23

Edit: Got my functions mixed - no problem with _FileListToArray - it was _FileReadToArray that changed syntax. :>

Edited by Melba23

Any of my own code posted anywhere on the forum is available for use by others without any restriction of any kind._______My UDFs:

Spoiler

ArrayMultiColSort ---- Sort arrays on multiple columns
ChooseFileFolder ---- Single and multiple selections from specified path treeview listing
Date_Time_Convert -- Easily convert date/time formats, including the language used
ExtMsgBox --------- A highly customisable replacement for MsgBox
GUIExtender -------- Extend and retract multiple sections within a GUI
GUIFrame ---------- Subdivide GUIs into many adjustable frames
GUIListViewEx ------- Insert, delete, move, drag, sort, edit and colour ListView items
GUITreeViewEx ------ Check/clear parent and child checkboxes in a TreeView
Marquee ----------- Scrolling tickertape GUIs
NoFocusLines ------- Remove the dotted focus lines from buttons, sliders, radios and checkboxes
Notify ------------- Small notifications on the edge of the display
Scrollbars ----------Automatically sized scrollbars with a single command
StringSize ---------- Automatically size controls to fit text
Toast -------------- Small GUIs which pop out of the notification area

 

Share this post


Link to post
Share on other sites

#3 ·  Posted (edited)

I use ver 3.3.6.

Thanks I Fixed with  _FileWriteFromArray. :thumbsup:

But I  want add All get names in " ". how can do it?

e.g :

"name 1"

"name 2"

.

.

.

.

Edited by behdadsoft

Share this post


Link to post
Share on other sites

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._______My UDFs:

Spoiler

ArrayMultiColSort ---- Sort arrays on multiple columns
ChooseFileFolder ---- Single and multiple selections from specified path treeview listing
Date_Time_Convert -- Easily convert date/time formats, including the language used
ExtMsgBox --------- A highly customisable replacement for MsgBox
GUIExtender -------- Extend and retract multiple sections within a GUI
GUIFrame ---------- Subdivide GUIs into many adjustable frames
GUIListViewEx ------- Insert, delete, move, drag, sort, edit and colour ListView items
GUITreeViewEx ------ Check/clear parent and child checkboxes in a TreeView
Marquee ----------- Scrolling tickertape GUIs
NoFocusLines ------- Remove the dotted focus lines from buttons, sliders, radios and checkboxes
Notify ------------- Small notifications on the edge of the display
Scrollbars ----------Automatically sized scrollbars with a single command
StringSize ---------- Automatically size controls to fit text
Toast -------------- Small GUIs which pop out of the notification area

 

Share this post


Link to post
Share on other sites

 

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.

Share this post


Link to post
Share on other sites

#6 ·  Posted (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 by michaelslamet

Share this post


Link to post
Share on other sites

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._______My UDFs:

Spoiler

ArrayMultiColSort ---- Sort arrays on multiple columns
ChooseFileFolder ---- Single and multiple selections from specified path treeview listing
Date_Time_Convert -- Easily convert date/time formats, including the language used
ExtMsgBox --------- A highly customisable replacement for MsgBox
GUIExtender -------- Extend and retract multiple sections within a GUI
GUIFrame ---------- Subdivide GUIs into many adjustable frames
GUIListViewEx ------- Insert, delete, move, drag, sort, edit and colour ListView items
GUITreeViewEx ------ Check/clear parent and child checkboxes in a TreeView
Marquee ----------- Scrolling tickertape GUIs
NoFocusLines ------- Remove the dotted focus lines from buttons, sliders, radios and checkboxes
Notify ------------- Small notifications on the edge of the display
Scrollbars ----------Automatically sized scrollbars with a single command
StringSize ---------- Automatically size controls to fit text
Toast -------------- Small GUIs which pop out of the notification area

 

Share this post


Link to post
Share on other sites

Thanks michaelslamet  :)

Thanks Melba23, Now work very well. :thumbsup:

Share this post


Link to post
Share on other sites

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 account

Sign in

Already have an account? Sign in here.


Sign In Now
Sign in to follow this  
Followers 0