--- In [email protected], "majesticartz" <majestica...@...> wrote: > > In the pproconf.exe config dialog on the "Command Lists Tab" > (specifically for the special command list "OPEN" (use this list > to run commands when windows open).
Here's a script that will sort a command list by Name/Label. Usually it is not desireable to do that, it will mess up Submenus, ContextIf's etc. The script is a minor update of a script I posted in May 2007. <http://tech.groups.yahoo.com/group/power-pro/message/31177> It seems to be fine, but I make no guarantees and you should check the results carefully. If there are any entries with empty Name labels, they do not appear in the new list. Ampersands in the Name are disregarded for purposes of sorting. If you want the result to be automatically imported into your pcf uncomment the two lines near the bottom: ;Configure.ImportCL(sortedini) ;Configure.WriteAllToPCF I believe the command Configure.WriteAllToPCF will save all resident command lists to the pcf, so you may prefer to import the "testsortB.ini" file manually from the Configure-Setup screen. Then in Configure, verify that the new version is to your liking, rename or delete the "original command list" and finally rename the "original command list Sorted" to the original name. Regards, Sheri local origini=pprofolder++"testsortA.ini" local sortedini=pprofolder++"testsortB.ini" cl.Export("AutoRun", origini) ;sorts origini by label ;saves to sortedini, new command list name is oldname++" Sorted" local regex_status KeyMenuTemplate topsect pat1 sVec count local sortedstring i KeyMenuTemplate=file.readall(origini) ;add a templabel so we can eliminate its ampersand KeyMenuTemplate=regex.pcreReplace(?"^Label(?: ?)=(?: ?).+$", ;;+ KeyMenuTemplate, ?"Temp$0\r\n$0", "multiline") ;remove first ampersand from templabel local temppat=?"(?<templabel>TempLabel(?: ?)=(?: ?).*?)(&)" KeyMenuTemplate=regex.pcreReplace(temppat, KeyMenuTemplate, ;;+ ?"$<templabel>", "multiline") topsect=regex.pcreMatchAll(?"(?s)\[.+?\r?\n(?=\[\d)", ;;+ KeymenuTemplate, ?"$0", "", 1) KeyMenuTemplate=select(KeyMenuTemplate, length(topsect)+1, ;;+ length(KeyMenuTemplate)) local longpat=?"(?s)(?<=\A|\r\n|\n)\[(\d+)\]\r?\n" longpat=longpat++?"TempLabel(?: ?)=(?: ?)(.+?)" longpat=longpat++?"(?=\r\n|\n).+?(?=\r?\n\[|\z)" pat1=regex.pcrecompile(longpat) sVec=vec.create(30,1) count=pat1.pcrematchall(KeyMenuTemplate, ?"$2--$0", "", 0, sVec) ;win.debug(regex_status, count++" matches") sVec.sort ;for (local i=0;i<sVec.length; i++) ;win.debug(sVec[i]) ;endfor local sortedstring=sVec.makelines sortedstring=regex.pcrereplace(?"(?m)^(.+?--)(\[)(?<num>\d+)",;;+ sortedstring, ?"$2$#") ;remove templabels sortedstring=regex.pcrereplace(?"(?m)^TempLabel.+\r\n",;;+ sortedstring, ?"") topsect=regex.pcrereplace(?"\[\K[^:\r\n]+",topsect, "$0 Sorted") KeyMenuTemplate=topsect++sortedstring i=file.writeall(sortedini, KeyMenuTemplate) ;Configure.ImportCL(sortedini) ;Configure.WriteAllToPCF messagebox("OK", "Done.") quit
