Sign in to follow this  
Followers 0
faustf

Sort List As Number

13 posts in this topic

#1 ·  Posted (edited)

hi guy i have a little problem whit this script

#include <File.au3>

Local $de = 'C:downloadsvicious1207201214_04_43'
$myList = _FileListToArray($de)
_FileCreate($de & "List.txt")
_FileWriteFromArray($de & "List.txt", $myList)

in folder i have a series of foto image1.bmp .................. image1204.bmp the last

but this script create not order file :huh:

1204

image1.bmp

image10.bmp

image100.bmp

image1000.bmp

image1001.bmp

image1002.bmp

image1003.bmp

image1004.bmp

image1005.bmp

image1006.bmp

image1007.bmp

image1008.bmp

image1009.bmp

image101.bmp

image1010.bmp

image1011.bmp

image1012.bmp

image1013.bmp

image1014.bmp

image1015.bmp

image1016.bmp

image1017.bmp

image1018.bmp

image1019.bmp

image102.bmp

image1020.bmp

image1021.bmp

image1022.bmp

image1023.bmp

image1024.bmp

image1025.bmp

image1026.bmp

image1027.bmp

image1028.bmp

image1029.bmp

image103.bmp

image1030.bmp

image1031.bmp

image1032.bmp

image1033.bmp

image1034.bmp

image1035.bmp

image1036.bmp

image1037.bmp

image1038.bmp

image1039.bmp

image104.bmp

image1040.bmp

image1041.bmp

image1042.bmp

image1043.bmp

image1044.bmp

image1045.bmp

image1046.bmp

image1047.bmp

image1048.bmp

image1049.bmp

image105.bmp

image1050.bmp

image1051.bmp

image1052.bmp

image1053.bmp

image1054.bmp

image1055.bmp

image1056.bmp

image1057.bmp

image1058.bmp

image1059.bmp

image106.bmp

image1060.bmp

image1061.bmp

image1062.bmp

image1063.bmp

image1064.bmp

image1065.bmp

image1066.bmp

image1067.bmp

image1068.bmp

image1069.bmp

image107.bmp

image1070.bmp

image1071.bmp

image1072.bmp

image1073.bmp

image1074.bmp

image1075.bmp

image1076.bmp

image1077.bmp

image1078.bmp

image1079.bmp

image108.bmp

image1080.bmp

image1081.bmp

image1082.bmp

image1083.bmp

image1084.bmp

image1085.bmp

image1086.bmp

image1087.bmp

image1088.bmp

image1089.bmp

image109.bmp

image1090.bmp

image1091.bmp

image1092.bmp

image1093.bmp

image1094.bmp

image1095.bmp

image1096.bmp

image1097.bmp

image1098.bmp

image1099.bmp

image11.bmp

image110.bmp

image1100.bmp

image1101.bmp

image1102.bmp

image1103.bmp

image1104.bmp

image1105.bmp

image1106.bmp

image1107.bmp

image1108.bmp

image1109.bmp

image111.bmp

image1110.bmp

image1111.bmp

image1112.bmp

image1113.bmp

image1114.bmp

image1115.bmp

image1116.bmp

image1117.bmp

image1118.bmp

image1119.bmp

image112.bmp

image1120.bmp

image1121.bmp

image1122.bmp

image1123.bmp

image1124.bmp

image1125.bmp

image1126.bmp

image1127.bmp

image1128.bmp

image1129.bmp

image113.bmp

image1130.bmp

image1131.bmp

image1132.bmp

image1133.bmp

image1134.bmp

image1135.bmp

image1136.bmp

image1137.bmp

image1138.bmp

image1139.bmp

image114.bmp

image1140.bmp

image1141.bmp

image1142.bmp

image1143.bmp

image1144.bmp

image1145.bmp

image1146.bmp

image1147.bmp

image1148.bmp

image1149.bmp

image115.bmp

image1150.bmp

image1151.bmp

image1152.bmp

image1153.bmp

image1154.bmp

image1155.bmp

image1156.bmp

image1157.bmp

image1158.bmp

image1159.bmp

image116.bmp

image1160.bmp

image1161.bmp

image1162.bmp

image1163.bmp

image1164.bmp

image1165.bmp

image1166.bmp

image1167.bmp

image1168.bmp

image1169.bmp

image117.bmp

image1170.bmp

image1171.bmp

image1172.bmp

image1173.bmp

image1174.bmp

image1175.bmp

image1176.bmp

image1177.bmp

image1178.bmp

image1179.bmp

image118.bmp

image1180.bmp

image1181.bmp

image1182.bmp

image1183.bmp

image1184.bmp

image1185.bmp

image1186.bmp

image1187.bmp

image1188.bmp

image1189.bmp

image119.bmp

image1190.bmp

image1191.bmp

image1192.bmp

image1193.bmp

image1194.bmp

image1195.bmp

image1196.bmp

image1197.bmp

image1198.bmp

image1199.bmp

image12.bmp

image120.bmp

image1200.bmp

image1201.bmp

image1202.bmp

image1203.bmp

image1204.bmp

image121.bmp

image122.bmp

image123.bmp

image124.bmp

image125.bmp

image126.bmp

image127.bmp

image128.bmp

image129.bmp

image13.bmp

image130.bmp

image131.bmp

image132.bmp

image133.bmp

image134.bmp

image135.bmp

image136.bmp

image137.bmp

image138.bmp

image139.bmp

image14.bmp

image140.bmp

image141.bmp

image142.bmp

image143.bmp

image144.bmp

image145.bmp

image146.bmp

image147.bmp

image148.bmp

image149.bmp

image15.bmp

image150.bmp

image151.bmp

image152.bmp

image153.bmp

image154.bmp

image155.bmp

image156.bmp

image157.bmp

image158.bmp

image159.bmp

image16.bmp

image160.bmp

image161.bmp

image162.bmp

image163.bmp

image164.bmp

image165.bmp

image166.bmp

image167.bmp

image168.bmp

image169.bmp

image17.bmp

image170.bmp

image171.bmp

image172.bmp

image173.bmp

image174.bmp

image175.bmp

image176.bmp

image177.bmp

image178.bmp

image179.bmp

image18.bmp

image180.bmp

image181.bmp

image182.bmp

image183.bmp

image184.bmp

image185.bmp

image186.bmp

image187.bmp

image188.bmp

image189.bmp

image19.bmp

image190.bmp

image191.bmp

image192.bmp

image193.bmp

image194.bmp

image195.bmp

image196.bmp

image197.bmp

image198.bmp

image199.bmp

image2.bmp

image20.bmp

image200.bmp

image201.bmp

image202.bmp

image203.bmp

image204.bmp

image205.bmp

image206.bmp

image207.bmp

image208.bmp

image209.bmp

image21.bmp

image210.bmp

image211.bmp

image212.bmp

image213.bmp

image214.bmp

image215.bmp

image216.bmp

image217.bmp

image218.bmp

image219.bmp

image22.bmp

image220.bmp

image221.bmp

image222.bmp

image223.bmp

image224.bmp

image225.bmp

image226.bmp

image227.bmp

image228.bmp

image229.bmp

image23.bmp

image230.bmp

image231.bmp

image232.bmp

image233.bmp

image234.bmp

image235.bmp

image236.bmp

image237.bmp

image238.bmp

image239.bmp

image24.bmp

image240.bmp

image241.bmp

image242.bmp

image243.bmp

image244.bmp

image245.bmp

image246.bmp

image247.bmp

image248.bmp

image249.bmp

image25.bmp

image250.bmp

image251.bmp

image252.bmp

image253.bmp

image254.bmp

image255.bmp

image256.bmp

image257.bmp

image258.bmp

image259.bmp

image26.bmp

image260.bmp

image261.bmp

image262.bmp

image263.bmp

image264.bmp

image265.bmp

image266.bmp

image267.bmp

image268.bmp

image269.bmp

image27.bmp

image270.bmp

image271.bmp

image272.bmp

image273.bmp

image274.bmp

image275.bmp

image276.bmp

image277.bmp

image278.bmp

image279.bmp

image28.bmp

image280.bmp

image281.bmp

image282.bmp

image283.bmp

image284.bmp

image285.bmp

image286.bmp

image287.bmp

image288.bmp

image289.bmp

image29.bmp

image290.bmp

image291.bmp

image292.bmp

image293.bmp

image294.bmp

image295.bmp

image296.bmp

image297.bmp

image298.bmp

image299.bmp

image3.bmp

image30.bmp

image300.bmp

image301.bmp

image302.bmp

image303.bmp

image304.bmp

image305.bmp

image306.bmp

image307.bmp

image308.bmp

image309.bmp

image31.bmp

image310.bmp

image311.bmp

image312.bmp

image313.bmp

image314.bmp

image315.bmp

image316.bmp

image317.bmp

image318.bmp

image319.bmp

image32.bmp

image320.bmp

image321.bmp

image322.bmp

image323.bmp

image324.bmp

image325.bmp

image326.bmp

image327.bmp

image328.bmp

image329.bmp

image33.bmp

image330.bmp

image331.bmp

image332.bmp

image333.bmp

image334.bmp

image335.bmp

image336.bmp

image337.bmp

image338.bmp

image339.bmp

image34.bmp

image340.bmp

image341.bmp

image342.bmp

image343.bmp

image344.bmp

image345.bmp

image346.bmp

image347.bmp

image348.bmp

image349.bmp

image35.bmp

image350.bmp

image351.bmp

image352.bmp

image353.bmp

image354.bmp

image355.bmp

image356.bmp

image357.bmp

image358.bmp

image359.bmp

image36.bmp

image360.bmp

image361.bmp

image362.bmp

image363.bmp

image364.bmp

image365.bmp

image366.bmp

image367.bmp

image368.bmp

image369.bmp

image37.bmp

image370.bmp

image371.bmp

image372.bmp

image373.bmp

image374.bmp

image375.bmp

image376.bmp

image377.bmp

image378.bmp

image379.bmp

image38.bmp

image380.bmp

image381.bmp

image382.bmp

image383.bmp

image384.bmp

image385.bmp

image386.bmp

image387.bmp

image388.bmp

image389.bmp

image39.bmp

image390.bmp

image391.bmp

image392.bmp

image393.bmp

image394.bmp

image395.bmp

image396.bmp

image397.bmp

image398.bmp

image399.bmp

image4.bmp

image40.bmp

image400.bmp

image401.bmp

image402.bmp

image403.bmp

image404.bmp

image405.bmp

image406.bmp

image407.bmp

image408.bmp

image409.bmp

image41.bmp

image410.bmp

image411.bmp

image412.bmp

image413.bmp

image414.bmp

image415.bmp

image416.bmp

image417.bmp

image418.bmp

image419.bmp

image42.bmp

image420.bmp

image421.bmp

image422.bmp

image423.bmp

image424.bmp

image425.bmp

image426.bmp

image427.bmp

image428.bmp

image429.bmp

image43.bmp

image430.bmp

image431.bmp

image432.bmp

image433.bmp

image434.bmp

image435.bmp

image436.bmp

image437.bmp

image438.bmp

image439.bmp

image44.bmp

image440.bmp

image441.bmp

image442.bmp

image443.bmp

image444.bmp

image445.bmp

image446.bmp

image447.bmp

image448.bmp

image449.bmp

image45.bmp

image450.bmp

image451.bmp

image452.bmp

image453.bmp

image454.bmp

image455.bmp

image456.bmp

image457.bmp

image458.bmp

image459.bmp

image46.bmp

image460.bmp

image461.bmp

image462.bmp

image463.bmp

image464.bmp

image465.bmp

image466.bmp

image467.bmp

image468.bmp

image469.bmp

image47.bmp

image470.bmp

image471.bmp

image472.bmp

image473.bmp

image474.bmp

image475.bmp

image476.bmp

image477.bmp

image478.bmp

image479.bmp

image48.bmp

image480.bmp

image481.bmp

image482.bmp

image483.bmp

image484.bmp

image485.bmp

image486.bmp

image487.bmp

image488.bmp

image489.bmp

image49.bmp

image490.bmp

image491.bmp

image492.bmp

image493.bmp

image494.bmp

image495.bmp

image496.bmp

image497.bmp

image498.bmp

image499.bmp

image5.bmp

image50.bmp

image500.bmp

image501.bmp

image502.bmp

image503.bmp

image504.bmp

image505.bmp

image506.bmp

image507.bmp

image508.bmp

image509.bmp

image51.bmp

image510.bmp

image511.bmp

image512.bmp

image513.bmp

image514.bmp

image515.bmp

image516.bmp

image517.bmp

image518.bmp

image519.bmp

image52.bmp

image520.bmp

image521.bmp

image522.bmp

image523.bmp

image524.bmp

image525.bmp

image526.bmp

image527.bmp

image528.bmp

image529.bmp

image53.bmp

image530.bmp

image531.bmp

image532.bmp

image533.bmp

image534.bmp

image535.bmp

image536.bmp

image537.bmp

image538.bmp

image539.bmp

image54.bmp

image540.bmp

image541.bmp

image542.bmp

image543.bmp

image544.bmp

image545.bmp

image546.bmp

image547.bmp

image548.bmp

image549.bmp

image55.bmp

image550.bmp

image551.bmp

image552.bmp

image553.bmp

image554.bmp

image555.bmp

image556.bmp

image557.bmp

image558.bmp

image559.bmp

image56.bmp

image560.bmp

image561.bmp

image562.bmp

image563.bmp

image564.bmp

image565.bmp

image566.bmp

image567.bmp

image568.bmp

image569.bmp

image57.bmp

image570.bmp

image571.bmp

image572.bmp

image573.bmp

image574.bmp

image575.bmp

image576.bmp

image577.bmp

image578.bmp

image579.bmp

image58.bmp

image580.bmp

image581.bmp

image582.bmp

image583.bmp

image584.bmp

image585.bmp

image586.bmp

image587.bmp

image588.bmp

image589.bmp

image59.bmp

image590.bmp

image591.bmp

image592.bmp

image593.bmp

image594.bmp

image595.bmp

image596.bmp

image597.bmp

image598.bmp

image599.bmp

image6.bmp

image60.bmp

image600.bmp

image601.bmp

image602.bmp

image603.bmp

image604.bmp

image605.bmp

image606.bmp

image607.bmp

image608.bmp

image609.bmp

image61.bmp

image610.bmp

image611.bmp

image612.bmp

image613.bmp

image614.bmp

image615.bmp

image616.bmp

image617.bmp

image618.bmp

image619.bmp

image62.bmp

image620.bmp

image621.bmp

image622.bmp

image623.bmp

image624.bmp

image625.bmp

image626.bmp

image627.bmp

image628.bmp

image629.bmp

image63.bmp

image630.bmp

image631.bmp

image632.bmp

image633.bmp

image634.bmp

image635.bmp

image636.bmp

image637.bmp

image638.bmp

image639.bmp

image64.bmp

image640.bmp

image641.bmp

image642.bmp

image643.bmp

image644.bmp

image645.bmp

image646.bmp

image647.bmp

image648.bmp

image649.bmp

image65.bmp

image650.bmp

image651.bmp

image652.bmp

image653.bmp

image654.bmp

image655.bmp

image656.bmp

image657.bmp

image658.bmp

image659.bmp

image66.bmp

image660.bmp

image661.bmp

image662.bmp

image663.bmp

image664.bmp

image665.bmp

image666.bmp

image667.bmp

image668.bmp

image669.bmp

image67.bmp

image670.bmp

image671.bmp

image672.bmp

image673.bmp

image674.bmp

image675.bmp

image676.bmp

image677.bmp

image678.bmp

image679.bmp

image68.bmp

image680.bmp

image681.bmp

image682.bmp

image683.bmp

image684.bmp

image685.bmp

image686.bmp

image687.bmp

image688.bmp

image689.bmp

image69.bmp

image690.bmp

image691.bmp

image692.bmp

image693.bmp

image694.bmp

image695.bmp

image696.bmp

image697.bmp

image698.bmp

image699.bmp

image7.bmp

image70.bmp

image700.bmp

image701.bmp

image702.bmp

image703.bmp

image704.bmp

image705.bmp

image706.bmp

image707.bmp

image708.bmp

image709.bmp

image71.bmp

image710.bmp

image711.bmp

image712.bmp

image713.bmp

image714.bmp

image715.bmp

image716.bmp

image717.bmp

image718.bmp

image719.bmp

image72.bmp

image720.bmp

image721.bmp

image722.bmp

image723.bmp

image724.bmp

image725.bmp

image726.bmp

image727.bmp

image728.bmp

image729.bmp

image73.bmp

image730.bmp

image731.bmp

image732.bmp

image733.bmp

image734.bmp

image735.bmp

image736.bmp

image737.bmp

image738.bmp

image739.bmp

image74.bmp

image740.bmp

image741.bmp

image742.bmp

image743.bmp

image744.bmp

image745.bmp

image746.bmp

image747.bmp

image748.bmp

image749.bmp

image75.bmp

image750.bmp

image751.bmp

image752.bmp

image753.bmp

image754.bmp

image755.bmp

image756.bmp

image757.bmp

image758.bmp

image759.bmp

image76.bmp

image760.bmp

image761.bmp

image762.bmp

image763.bmp

image764.bmp

image765.bmp

image766.bmp

image767.bmp

image768.bmp

image769.bmp

image77.bmp

image770.bmp

image771.bmp

image772.bmp

image773.bmp

image774.bmp

image775.bmp

image776.bmp

image777.bmp

image778.bmp

image779.bmp

image78.bmp

image780.bmp

image781.bmp

image782.bmp

image783.bmp

image784.bmp

image785.bmp

image786.bmp

image787.bmp

image788.bmp

image789.bmp

image79.bmp

image790.bmp

image791.bmp

image792.bmp

image793.bmp

image794.bmp

image795.bmp

image796.bmp

image797.bmp

image798.bmp

image799.bmp

image8.bmp

image80.bmp

image800.bmp

image801.bmp

image802.bmp

image803.bmp

image804.bmp

image805.bmp

image806.bmp

image807.bmp

image808.bmp

image809.bmp

image81.bmp

image810.bmp

image811.bmp

image812.bmp

image813.bmp

image814.bmp

image815.bmp

image816.bmp

image817.bmp

image818.bmp

image819.bmp

image82.bmp

image820.bmp

image821.bmp

image822.bmp

image823.bmp

image824.bmp

image825.bmp

image826.bmp

image827.bmp

image828.bmp

image829.bmp

image83.bmp

image830.bmp

image831.bmp

image832.bmp

image833.bmp

image834.bmp

image835.bmp

image836.bmp

image837.bmp

image838.bmp

image839.bmp

image84.bmp

image840.bmp

image841.bmp

image842.bmp

image843.bmp

image844.bmp

image845.bmp

image846.bmp

image847.bmp

image848.bmp

image849.bmp

image85.bmp

image850.bmp

image851.bmp

image852.bmp

image853.bmp

image854.bmp

image855.bmp

image856.bmp

image857.bmp

image858.bmp

image859.bmp

image86.bmp

image860.bmp

image861.bmp

image862.bmp

image863.bmp

image864.bmp

image865.bmp

image866.bmp

image867.bmp

image868.bmp

image869.bmp

image87.bmp

image870.bmp

image871.bmp

image872.bmp

image873.bmp

image874.bmp

image875.bmp

image876.bmp

image877.bmp

image878.bmp

image879.bmp

image88.bmp

image880.bmp

image881.bmp

image882.bmp

image883.bmp

image884.bmp

image885.bmp

image886.bmp

image887.bmp

image888.bmp

image889.bmp

image89.bmp

image890.bmp

image891.bmp

image892.bmp

image893.bmp

image894.bmp

image895.bmp

image896.bmp

image897.bmp

image898.bmp

image899.bmp

image9.bmp

image90.bmp

image900.bmp

image901.bmp

image902.bmp

image903.bmp

image904.bmp

image905.bmp

image906.bmp

image907.bmp

image908.bmp

image909.bmp

image91.bmp

image910.bmp

image911.bmp

image912.bmp

image913.bmp

image914.bmp

image915.bmp

image916.bmp

image917.bmp

image918.bmp

image919.bmp

image92.bmp

image920.bmp

image921.bmp

image922.bmp

image923.bmp

image924.bmp

image925.bmp

image926.bmp

image927.bmp

image928.bmp

image929.bmp

image93.bmp

image930.bmp

image931.bmp

image932.bmp

image933.bmp

image934.bmp

image935.bmp

image936.bmp

image937.bmp

image938.bmp

image939.bmp

image94.bmp

image940.bmp

image941.bmp

image942.bmp

image943.bmp

image944.bmp

image945.bmp

image946.bmp

image947.bmp

image948.bmp

image949.bmp

image95.bmp

image950.bmp

image951.bmp

image952.bmp

image953.bmp

image954.bmp

image955.bmp

image956.bmp

image957.bmp

image958.bmp

image959.bmp

image96.bmp

image960.bmp

image961.bmp

image962.bmp

image963.bmp

image964.bmp

image965.bmp

image966.bmp

image967.bmp

image968.bmp

image969.bmp

image97.bmp

image970.bmp

image971.bmp

image972.bmp

image973.bmp

image974.bmp

image975.bmp

image976.bmp

image977.bmp

image978.bmp

image979.bmp

image98.bmp

image980.bmp

image981.bmp

image982.bmp

image983.bmp

image984.bmp

image985.bmp

image986.bmp

image987.bmp

image988.bmp

image989.bmp

image99.bmp

image990.bmp

image991.bmp

image992.bmp

image993.bmp

image994.bmp

image995.bmp

image996.bmp

image997.bmp

image998.bmp

image999.bmp

is possible have progressive list ?' thankzz

Edited by Melba23

Share this post


Link to post
Share on other sites



faustf,

I split this off from the Examples thread as it is a separate question from that in the thread even if the code is the same. ;)

You need to sort the numbers as numbers and not alphabetically. The best way I know to do this is like this:

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

; Get the list
Local $de = 'C:downloadsvicious1207201214_04_43'
$myList = _FileListToArray($de)

; And this is what we get
_ArrayDisplay($myList)

; Create a 2D array of the correct size
Global $aOrder[UBound($myList)][2]
; And fill it
For $i = 0 To $aList[0]
    ; Copy file name
    $aOrder[$i][0] = $myList[$i]
    ; Extract the digits from the file name - and convert to number type
    $aOrder[$i][1] = Number(StringRegExpReplace($myList[$i], "(?U).*(d*).bmp", "$1"))
Next

; Here is the result
_ArrayDisplay($aOrder)

; Now sort the number column - omitting the count element
_ArraySort($aOrder, 0, 1, 0, 1)

; And here we have your numerically ordered list
_ArrayDisplay($aOrder)

All clear? :)

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

o sorry i give me a erro for declaretion

i correct whit this

Local $aList[99999]

but i dont understund nothing , the script give me the same bad list :huh:

Share this post


Link to post
Share on other sites

faustf,

Are you saying that you see no difference between the 2D arrays in the final _ArrayDisplay dialogs? :huh:

Note that the script does not change the order of $myList. It reorders the 2D $aSort array so you will have to use the first column of that as your list - or copy the new listing back into $myList like this: ;)

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

; Get the list
Global $aList _FileListToArray("Your_Path")

; And this is what we get
_ArrayDisplay($aList)

; Create a 2D array of the correct size
Global $aOrder[UBound($aList)][2]
; And fill it
For $i = 0 To $aList[0]
    ; Copy file name
    $aOrder[$i][0] = $aList[$i]
    ; Extract the digits - and convert to number type
    $aOrder[$i][1] = Number(StringRegExpReplace($aList[$i], "(?U).*(d*).bmp", "$1"))
Next

; Here is the result
_ArrayDisplay($aOrder)

; Now sort the number column
_ArraySort($aOrder, 0, 1, 0, 1)


; And here we have your numerically ordered list
_ArrayDisplay($aOrder)

; Which we copy back
For $i = 1 To $aList[0]
    $aList[$i] = $aOrder[$i][0]
Next

; With the final result
_ArrayDisplay($aList)

This works perfectly for me on the file list you posted above - does it work for you? :huh:

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

copy and past your script , but have this error

E:_recorder-screentestcedcdef.au3(5,15) : ERROR: syntax error
Global $aList _FileListToArray
~~~~~~~~~~~~~~^
E:_recorder-screentestcedcdef.au3 - 1 error(s), 0 warning(s)
!>18:27:18 AU3Check ended.rc:2
>Exit code: 0    Time: 10.371

Share this post


Link to post
Share on other sites

#6 ·  Posted (edited)

faustf,

It is a simple typo - can you not fix it yourself? ;)

M23

Edit:

I do not have all those files in a folder so I am simulating that line with a _FileReadToArray so we end up with the same array. I just missed the "=" when I replaced the line. ;)

Edited by Melba23
Added explanation

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

o thnakzz alot i am fuse now i go to run and tonight try to find , solution :) , thankzzz alot for your help you are a friend :)

bye and have good time :)

Share this post


Link to post
Share on other sites

faustf,

tonight try to find , solution

What I have given you is a solution. :)

Just post the exact code you are using and we will try and see why it is not working. :)

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

#10 ·  Posted (edited)

JohnOne,

I am so sorry it happened - I will try very hard not to do anything like that again. :oops:

M23

:P

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

i use only this code

#include <File.au3>
Local $de = 'C:downloadsvicious1207201214_04_43'
$myList = _FileListToArray($de)
_FileCreate($de & "List.txt")
_FileWriteFromArray($de & "List.txt", $myList)

Share this post


Link to post
Share on other sites

faustf,

You need to integrate the code I proposed into that snippet:

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

; Get the list
Local $de = 'C:downloadsvicious1207201214_04_43'
$myList = _FileListToArray($de)

; And this is what we get
_ArrayDisplay($myList)

; Create a 2D array of the correct size
Global $aOrder[UBound($myList)][2]
; And fill it
For $i = 0 To $myList[0]
    ; Copy file name
    $aOrder[$i][0] = $myList[$i]
    ; Extract the digits - and convert to number type
    $aOrder[$i][1] = Number(StringRegExpReplace($myList[$i], "(?U).*(d*).bmp", "$1"))
Next

; Here is the result
_ArrayDisplay($aOrder)

; Now sort the number column - note we do not sort the count element in [0]
_ArraySort($aOrder, 0, 1, 0, 1) 

; And here we have your numerically ordered list
_ArrayDisplay($aOrder)

; Which we copy back to the original array
For $i = 1 To $myList[0]
    $myList[$i] = $aOrder[$i][0]
Next

; With the final result
_ArrayDisplay($myList)

; And here you can write it - no need to open it first
_FileWriteFromArray($de & "List.txt", $myList)

Does that work? :)

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

#13 ·  Posted (edited)

Melba, I posted this awhile back. Just adds an optional parameter to the array sort. The user can write a function that does the custom comparison and sort in place. Kind of like how QSort worked in the old standard C libraries passing in a function pointer.

In this case the custom function would just glean the numeric parts of the names and compare them. The return value should be less than, equal to, or greater than zero, just as in StringCompare function.

Edited by MilesAhead

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