Jump to content

Leaderboard

Popular Content

Showing content with the highest reputation on 12/28/2014 in all areas

  1. You don't want to use a hotkey? Okay, so now the question... "What method would you like to use to tell the script to stop looping?" Edit: P.S. Not sure yelling at it without code to interpret and a mic is going to work.
    1 point
  2. This topic is a long run #include <Array.au3> $sList = "ts-almojadilah5-3.mp3;ts-almojadilah6-1.mp3;ts-almojadilah6-2.mp3;ts-almojadilah4-4.mp3;" & _ "ts-almojadilah4-5.mp3;ts-almojadilah5-1.mp3;ts-almojadilah7-3.mp3;ts-almojadilah7-4.mp3;" & _ "ts-almojadilah7.mp3;ts-almojadilah6-3.mp3;ts-almojadilah7-1.mp3;ts-almojadilah7-2.mp3;" & _ "ts-almojadilah4-3.mp3;ts-almojadilah2-2.mp3;ts-almojadilah2-3.mp3;ts-almojadilah2-1.mp3;" & _ "ts-almojadilah1-1.mp3;ts-almojadilah1-2.mp3;ts-almojadilah2-4.mp3;ts-almojadilah4-1.mp3;" & _ "ts-almojadilah4-2.mp3;ts-almojadilah3-3.mp3;ts-almojadilah3-1.mp3;ts-almojadilah3-2.mp3;" & _ "1-1.mp3;1-2.mp3;15.mp3;10-1.mp3;10-3.mp3;2-1.mp3;2-2.mp3;20-1.mp3;test3.txt" $aList = StringSplit($sList, ";", 2) _ArrayDisplay($aList) _ArrayColInsert($aList, 1) For $i = 0 To UBound($aList)-1 $aList[$i][1] = Execute(StringRegExpReplace($aList[$i][0], _ '(.*?)(\d+)-?(\d+)?(.mp3)', "'$1' & StringFormat('%04i', '$2') & '.$3' & ") & "''") Next _ArraySort($aList, 0, 0, 0, 1) _ArrayColDelete($aList, 1) _ArrayDisplay($aList)
    1 point
  3. Relax ... give people time to stop by and reply when they want. Out rules is not to bump threads with 24 hours.
    1 point
  4. Maybe you can try with Binary instead of Number : #include <Array.au3> ; Simulate reading files with mp3 extension only $sList = "ts-almojadilah5-3.mp3;ts-almojadilah6-1.mp3;ts-almojadilah6-2.mp3;ts-almojadilah4-4.mp3;" & _ "ts-almojadilah4-5.mp3;ts-almojadilah5-1.mp3;ts-almojadilah7-3.mp3;ts-almojadilah7-4.mp3;" & _ "ts-almojadilah7-5.mp3;ts-almojadilah6-3.mp3;ts-almojadilah7-1.mp3;ts-almojadilah7-2.mp3;" & _ "ts-almojadilah4-3.mp3;ts-almojadilah2-2.mp3;ts-almojadilah2-3.mp3;ts-almojadilah2-1.mp3;" & _ "ts-almojadilah1-1.mp3;ts-almojadilah1-2.mp3;ts-almojadilah2-4.mp3;ts-almojadilah4-1.mp3;" & _ "ts-almojadilah4-2.mp3;ts-almojadilah3-3.mp3;ts-almojadilah3-1.mp3;ts-almojadilah3-2.mp3" $aList = StringSplit($sList, ";") _ArrayColInsert($aList, 1) For $i = 1 To $aList[0][0] $aList[$i][1] = Binary(StringReplace(StringReplace($aList[$i][0] , ".mp3", ""), "-", ".")) Next _ArrayDisplay($aList) _ArraySort($aList, 0, 0, 0, 1) _ArrayColDelete($aList, 1) _ArrayDisplay($aList, "Final", Default, 8)
    1 point
  5. Alexxander, It looks as if you want to show only .mp3 files - if that is the case then use the filter parameter of _FileListToArray to only list those files. Then the sort works as you wish: #include <Array.au3> ; Simulate reading files with mp3 extension only $sList = "14.mp3:16.mp3:8-1.mp3:8-2.mp3:10-1.mp3:10-2.mp3:11-1.mp3:11-2.mp3:11-3.mp3:13-2.mp3:13-3.mp3:15-1.mp3:15-2.mp3" $aList = StringSplit($sList, ":") _ArrayColInsert($aList, 1) For $i = 1 To $aList[0][0] $aList[$i][1] = Number(StringReplace(StringReplace($aList[$i][0], ".mp3", ""), "-", ".")) Next _ArraySort($aList, 0, 0, 0, 1) _ArrayColDelete($aList, 1) _ArrayDisplay($aList, "Final", Default, 8) M23
    1 point
  6. Also, we can add some blanks before each value, to have all strings with the same length (128 for example), and then sort the array : #include <Array.au3> ; Simulate reading files $sList = "8-1.mp3:8-2.mp3:10-2.mp3:8-4.mp3:8-5.mp3:10-1.mp3:8-3.mp3" $aList = StringSplit($sList, ":") _ArrayDisplay($aList, "Unsorted", Default, 8) ; Now create a 2D array... _ArrayColInsert($aList, 1) ; ...and set the [1] element to the number For $i = 1 To $aList[0][0] ; Adds spaces on the left, to have 128 caracters string $aList[$i][1] = StringFormat("%128s", $aList[$i][0] ) Next _ArrayDisplay($aList, "2D", Default, 8) _ArraySort($aList, 0, 0, 0, 1) _ArrayColDelete($aList, 1) _ArrayDisplay($aList, "Number column", Default, 8)
    1 point
  7. Alexxander, You need to sort the items numerically - at present you are sorting them as alphabetic strings. Here is how you might go about it: #include <Array.au3> ; Simulate reading files $sList = "8-1.mp3:8-2.mp3:10-2.mp3:8-4.mp3:8-5.mp3:10-1.mp3:8-3.mp3" $aList = StringSplit($sList, ":") _ArrayDisplay($aList, "Unsorted", Default, 8) ; Now create a 2D array... _ArrayColInsert($aList, 1) _ArrayDisplay($aList, "2D", Default, 8) ; ...and set the [1] element to the number For $i = 1 To $aList[0][0] $aList[$i][1] = Number(StringRegExpReplace($aList[$i][0], "[^0-9]", "")) Next _ArrayDisplay($aList, "Number column", Default, 8) ; Now sort the items numerically _ArraySort($aList, 0, 1, 0, 1) _ArrayDisplay($aList, "Numerical Sort", Default, 8) ; And finally remove the number column _ArrayColDelete($aList, 1) _ArrayDisplay($aList, "Final", Default, 8) All clear? M23
    1 point
  8. Yes, delete the first value in the array (7) (before sorting) which is the number of files then sort by ascending not descending
    1 point
×
×
  • Create New...