Jump to content

Recommended Posts

Posted

Hi, i just noticed this annoying thing in my music player, in which the files that have numbers are not in sequence, see example attached.

1, 11, 12, 2, 3, 4..

I'm currently using _FileListToArrayRec

Open to suggestions.

Thanks in advance.

screenshot - 14012022-2031.jpg

  Reveal hidden contents

IUIAutomation - Topic with framework and examples

Au3Record.exe

  • Moderators
Posted

careca,

It is because the elements are strings and so are sorted alphabetically. I suggest adding a leading 0 to the number - then the sort will be as you wish.

M23

Public_Domain.png.2d871819fcb9957cf44f4514551a2935.png 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:

  Reveal hidden contents

 

Posted

Thank you for the input and suggestions.

  Reveal hidden contents

IUIAutomation - Topic with framework and examples

Au3Record.exe

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

$aTxt = FileReadToArray("test.txt") ; This is a list of tracks not in order

Local $aNew[UBound($aTxt)][2]
For $i = 0 To UBound($aTxt) - 1
    $aMatch = StringRegExp($aTxt[$i], "\d{1,2}", 1)
    $aNew[$i][0] = StringFormat("%02i", $amatch[0])
    $aNew[$i][1] = $aTxt[$i]
Next

_ArraySort($aNew)
_ArrayColDelete($aNew, 0)
_ArrayDisplay($aNew)

 

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
  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...