tamir Posted January 8, 2005 Share Posted January 8, 2005 ok i have 2 lists: 1 with files and 1 with their sizes.i update the lists with a function, but when i do that the sizes mixing up in the order.for examplei have 3 files |file name(size)|:abc.txt(3485)def.exe(8325)ghi.au3(1209)and the list order them like this:name--------sizeabc.txt-------1209def.exe------3485ghi.au3------8325the function is this:Func _FilesAddToList($par, $type) If $type == "" Then $type = "*.???" $scan = FileFindFirstFile(Eval("dir_" & $par) & "\" & $type) $list = "" $fsize = "" While $scan <> - 1 $file = FileFindNextFile($scan) If @error Then FileClose($scan) ExitLoop EndIf If NOT ($file == "." Or $file == "..") Then $list = $list & "|" & $file $fsize = $fsize & "|" & FileGetSize($file) EndIf WEnd GUICtrlSetData(Eval("list_" & $par), $list) GUICtrlSetData(Eval("list_" & $par & "_size"), $fsize) EndFuncso whats the problem?and btw, if i want to change bytes to Mb, what number to divide with? Link to comment Share on other sites More sharing options...
buzz44 Posted January 8, 2005 Share Posted January 8, 2005 (edited) not sure how to help with first bit , but to divide in to MB use this / 1024 / 1024 if u want to divide in gig, / 1024 / 1024 / 1024 etc. This returns the size with like 20 decimal places but so use Round (exp[b][/b]ression , decimalplaces) to set a decimal place, i found 2 dp is nice Edited January 8, 2005 by burrup qq Link to comment Share on other sites More sharing options...
Developers Jos Posted January 8, 2005 Developers Share Posted January 8, 2005 (edited) ok i have 2 lists: 1 with files and 1 with their sizes.so whats the problem?and btw, if i want to change bytes to Mb, what number to divide with?<{POST_SNAPBACK}>The issue is that the listboxes will sort their values so mix up the sequence.Its probably better to use 1 listbox with mutiple columns to keep name and size together... Edited January 8, 2005 by JdeB SciTE4AutoIt3 Full installer Download page - Beta files Read before posting How to post scriptsource Forum etiquette Forum Rules Live for the present, Dream of the future, Learn from the past. Link to comment Share on other sites More sharing options...
tamir Posted January 8, 2005 Author Share Posted January 8, 2005 ok, thanks for both Link to comment Share on other sites More sharing options...
Recommended Posts
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 accountSign in
Already have an account? Sign in here.
Sign In Now