Sign in to follow this  
Followers 0
Alexxander

copy non ordered filenames to a text file

10 posts in this topic

hi all
i have a group of files that i had sorted tham manually
file3.png
file2.png
file5.png
file8.png
file7.png
 
i want to make autoit get all the files names and but them in one txt file an keep the same order
so the txt fiel content must be
 
file3.png/file2.png/file5.png/file8.png/file7.png
 
i tried filelisttoarray and then write the array to txt file but Auoit is automatically sorting them alphabetically 
i want it t keep the sorting as it is and write them to the file as they are without ordering them
 
any ideas ?

Share this post


Link to post
Share on other sites



_FileListToArray doesn't sort the list, that's the list that Windows presents to it, it's just using FileFindFirstFile and FileFindNextFile, and then sticking them into the array.


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 Gude
How 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

Share this post


Link to post
Share on other sites

What are they sorted by, createddate? Modifieddate? some other attribute?

FSO (filesystemobject) will allow you to create a loop to perform such a sort, but we need to know the particulars.


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.

Share this post


Link to post
Share on other sites

What are they sorted by, createddate? Modifieddate? some other attribute?

FSO (filesystemobject) will allow you to create a loop to perform such a sort, but we need to know the particulars.

their is no sort 

i had placed them manually  drag and drop


Share this post


Link to post
Share on other sites

I'm not understanding then.  Explorer always includes a sort....you can't manually pick where you want them to be.


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.

Share this post


Link to post
Share on other sites

#6 ·  Posted (edited)

I've never encountered "unsorting", the only folder on which you can have files unsorted is the desktop. Every other directory has a default sort order imposed by the OS. What is the directory, or how about a screenshot?

Edited by JLogan3o13

√-1 2^3 ∑ π, and it was delicious!

Share this post


Link to post
Share on other sites

Agreed, and even if you got the files from your desktop, it would be sorted.  It's just the view that can be modified.


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.

Share this post


Link to post
Share on other sites

In Windows XP and below, if you drag and drop files into an Explorer window, the listing of files will continue to show the order in which the files were dragged.  E.G. Drag 1.txt, 3.txt, and then 2.txt, and the files will be in that order.  Above Windows XP (or is it Vista??), Explorer will reorder the files immediately.

Alexxander, if what I describe matches what you see, then the order you see doesn't actually exist.  It's just an artifact of Windows not yet performing a refresh.  Press F5 to see what I mean.

 

Of course this may be something totally different.  If so, then I apologize for butting in. :)


How's my riding? Dial 1-800-Wait-There

Trying to use a computer with McAfee installed is like trying to read a book at a rock concert.

Share this post


Link to post
Share on other sites

Here you go, even if the files aren't random you can make them so :D

#include <Array.au3>
#include <File.au3>

Local $aArray = []
Local $aTemp = _FileListToArray(@DesktopDir & "\Test", "*.png")

    For $i = 1 To $aTemp[0]
        $iIndex = Random(1, $aTemp[0])
        _ArrayAdd($aArray, $aTemp[$iIndex])
    Next

    _ArrayDisplay($aArray)

√-1 2^3 ∑ π, and it was delicious!

Share this post


Link to post
Share on other sites

#10 ·  Posted (edited)

Would probably want to do a step -1, and _arraydelete from $aTemp, to make sure you don't duplicate files :).

#include <array.au3>
#include <File.au3>

DirCreate(@DesktopDir & "\Testing2")
_FileCreate(@DesktopDir & "\Testing2\File3.png")
_FileCreate(@DesktopDir & "\Testing2\File2.png")
_FileCreate(@DesktopDir & "\Testing2\File5.png")
_FileCreate(@DesktopDir & "\Testing2\File8.png")
_FileCreate(@DesktopDir & "\Testing2\File7.png")

Local $aArray=""
Local $aTemp = _FileListToArray(@DesktopDir & "\Testing2", "*.png")
_ArrayDelete($aTemp, 0)
For $i = UBound($aTemp)-1 To 0 Step -1
    $iIndex = Random(0, UBound($aTemp)-1,1)
    If Not IsArray($aArray) Then
        Local $aArray[1]=[$aTemp[$iIndex]]
    Else
        _ArrayAdd($aArray, $aTemp[$iIndex])
    EndIf
    _ArrayDelete($aTemp, $iIndex)
Next

_ArrayDisplay($aArray)
Edited by jdelaney

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.

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