gcue Posted August 28, 2008 Posted August 28, 2008 how would you go about alphabetizing the values under a given section: [section_name] Frank=232323 Albert=34342323 Zeek=23232323 Barbara=231212 any ideas?
oMBRa Posted August 28, 2008 Posted August 28, 2008 (edited) MATH IS THE KEY! u can associate each letter of the alphabet with a number like: a = 1 b = 2 then compare them with the first letter of each values name and write it in order Edited August 28, 2008 by oMBra
PsaltyDS Posted August 28, 2008 Posted August 28, 2008 how would you go about alphabetizing the values under a given section: [section_name] Frank=232323 Albert=34342323 Zeek=23232323 Barbara=231212 any ideas? IniReadSection() _ArraySort() IniWriteSection() Valuater's AutoIt 1-2-3, Class... Is now in Session!For those who want somebody to write the script for them: RentACoder"Any technology distinguishable from magic is insufficiently advanced." -- Geek's corollary to Clarke's law
gcue Posted August 28, 2008 Author Posted August 28, 2008 great idea psalty! not sure why i get an array error though: "an array variable has incorrect number of subscripts or subscript dimension range exceeded." $a = IniReadSection("assets.ini", "section_name") _ArraySort($a) _ArrayDisplay($a) IniWriteSection("test.ini", "section_name", $a) if i comment out the _arraysort($a) i dont get the error.
PsaltyDS Posted August 28, 2008 Posted August 28, 2008 great idea psalty! not sure why i get an array error though: "an array variable has incorrect number of subscripts or subscript dimension range exceeded." $a = IniReadSection("assets.ini", "section_name") _ArraySort($a) _ArrayDisplay($a) IniWriteSection("test.ini", "section_name", $a) if i comment out the _arraysort($a) i dont get the error. The count is in $a[0][0], and you don't want that sorted in with the rest. Use _ArraySort($a, 0, 1) instead (see the help file). Also, make sure you are running the current version. Valuater's AutoIt 1-2-3, Class... Is now in Session!For those who want somebody to write the script for them: RentACoder"Any technology distinguishable from magic is insufficiently advanced." -- Geek's corollary to Clarke's law
gcue Posted August 28, 2008 Author Posted August 28, 2008 yep i had also checked the help file and tried 0,1 but i still get the error: heres what the arraydisplay looks like (wout the sort): Row Col 0 Col1 [0] 4 [1] Frank 232323 [2] Albert 232323 [3] Zeek 22332323 [4] Barbara 23232323
PsaltyDS Posted August 28, 2008 Posted August 28, 2008 yep i had also checked the help file and tried 0,1 but i still get the error: heres what the arraydisplay looks like (wout the sort): Row Col 0 Col1 [0] 4 [1] Frank 232323 [2] Albert 232323 [3] Zeek 22332323 [4] Barbara 23232323 This works fine: #Include <Array.au3> Global $avArray[5][2] = [[4, ""], ["Frank", 232323], ["Albert", 232323], _ ["Zeek", 22332323], ["Barbara", 23232323]] _ArraySort($avArray, 0, 1) _ArrayDisplay($avArray) What version of AutoIt are you running? Valuater's AutoIt 1-2-3, Class... Is now in Session!For those who want somebody to write the script for them: RentACoder"Any technology distinguishable from magic is insufficiently advanced." -- Geek's corollary to Clarke's law
gcue Posted August 28, 2008 Author Posted August 28, 2008 the example you posted didnt work for me either =/ im using 3.2.10 i need to use this version bc this is part of a ~8000 line script and theres too many things to fix if i upgrade the complier. =/
PsaltyDS Posted August 28, 2008 Posted August 28, 2008 the example you posted didnt work for me either =/im using 3.2.10i need to use this version bc this is part of a ~8000 line script and theres too many things to fix if i upgrade the complier. =/I think you've said that before... and that excuse is only going to get more lame as time goes on... ("8000 lines" = "Too big to maintain") = False Valuater's AutoIt 1-2-3, Class... Is now in Session!For those who want somebody to write the script for them: RentACoder"Any technology distinguishable from magic is insufficiently advanced." -- Geek's corollary to Clarke's law
gcue Posted August 28, 2008 Author Posted August 28, 2008 lol! well actually i dont think anything else will get added to this script.. its definitely coming to a close. so id liek to just get this last change working on 3.2.10
weaponx Posted August 28, 2008 Posted August 28, 2008 I think you've said that before... and that excuse is only going to get more lame as time goes on... ("8000 lines" = "Too big to maintain") = False He probably doesn't upgrade to digital cable because "its too many channels to maintain".
PsaltyDS Posted August 28, 2008 Posted August 28, 2008 lol!well actually i dont think anything else will get added to this script.. its definitely coming to a close. so id liek to just get this last change working on 3.2.10You could try updating just that function in your Array.au3 UDF file. Can't help you get service for that dial phone, though. Valuater's AutoIt 1-2-3, Class... Is now in Session!For those who want somebody to write the script for them: RentACoder"Any technology distinguishable from magic is insufficiently advanced." -- Geek's corollary to Clarke's law
JFee Posted August 28, 2008 Posted August 28, 2008 Thanks for this idea... I've been meaning to alphabetize the entire ini by sections. I think I'll just IniReadSectionNames then loop through each one adding it to a variable containing all of the new alphabetized INI, then I'll have to FileWrite it. Does that sound about right? Regards,Josh
YellowLab Posted August 28, 2008 Posted August 28, 2008 (edited) @JFee, sounds right. However, I am a little confused why you would necessarily need an ini file alphabetized. You can alphabetize the entries for lists at the time they are needed to be displayed or compared. Just curious why you want to add the write time to make the internal aspects of a file look pretty? Also, if the ini files get large, it may be faster to use an SQLite database for storing these values. Alphabetizing the database is much faster. Bob Edited August 28, 2008 by YellowLab You can't see a rainbow without first experiencing the rain.
gcue Posted August 28, 2008 Author Posted August 28, 2008 my ini entries are displayed as icons.. i want to alphabetize just for easy readability reasons
JFee Posted August 28, 2008 Posted August 28, 2008 Thanks for the reply. I have a ComboBox withe the style $CBS_SORT, and i have a bunch of information derived by a number of INI files. Nothing is broken right now, however it calls a function and loads information associated with the first INI section. Regards,Josh
gcue Posted August 30, 2008 Author Posted August 30, 2008 ok i think i know why theres an error.. the array display has two columns not just one... any ideas??
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