dirks: -------------------------------------------------------------------------------- Hi vbr,
it works like charm, I just tried :-D And it solves my problem in the first place :) Yay! :-D Thank you very much! Right now I'm undecided whether using a script is worth the effort, but I'd need to do the series of operations everytime I load such a file into PS*Pad* for comparison, which is several times a day (5-15 times, I guess)... so... every short-cut or automation of (a part of) these operations would be a very appreciated improvement - if you know of any such short-cut or automations, please tell! :) (Meanwhile I have looked at [url=https://en.wikipedia.org/wiki/Sorting_algorithm#Comparison_of_algorithms]so rting algorithms[/url] and found that there are several that provide a "stable" result and don't need to be slow... But so far I don't know yet how to call a script from PS*Pad* and get the manipulated file or editor-object back.) -------------------------------------------------------------------------------- Hi, you are welcome, I am glad, it helped.; I just tried to write a javascript sorting function for this; you may try it on your input files and probably modify it to work as needed, also for possible cornercases. The text is replaced for the original editor content, you may use copies, if needed. just save the following e.g. as a js file in ...\PSPad\script\JScript\my_pspad_javascripts.js cite: -------------------------------------------------------------------------------- var module_name = "pspad_js"; var module_ver = "0.1"; function presortXML(){ if (editorsCount()<1){return;} // quit if no text window is open var actEd = newEditor(); actEd.assignActiveEditor(); var inputTxt = actEd.text(); // get the whole text var outputTxt = inputTxt; // perform some subsequent text conversions outputTxt = outputTxt.replace(/(<Meta name="\S+_key_id)(.{0})(" value="\S+" \/>)/g, "$1____________$3"); // add placeholder for temporary numbering var repl_nr_counter = 1000; outputTxt = outputTxt.replace(/(____________)/g, function(m){repl_nr_counter+=1; return "__"+repl_nr_counter+"__";});// temporary sequential numbering - up to 900 items! var linesArr = outputTxt.split(" "); linesArr.sort(); // sort lines lexicographically respecting the temporary numbering outputTxt = linesArr.join("\n"); outputTxt = outputTxt.replace(/__\d+__/g, ""); // remove the intermediate numbering actEd.text(outputTxt); // set the modified text content } function Init(){ addMenuItem("presort", "", "presortXML", "Ctrl+Alt+Shift+W");// labels and shortcuts can be modified } -------------------------------------------------------------------------------- After calling Script: Reload script (or on a fresh start of PSPad) this function should be available via script-menu or directly with the shortcuts set in the Init() function (this must not be taken by any other function etc.) Please test it to match all your requirements -especially the content of the original data - the regex should match whole lines, you are interested in. There must not be any data in the format used for intermediate numbering, i.e. __somenumber__ ; otherwise the sorting might break and the text could be corrupted. Another limitaion of the current PSPad is the scripting support for unicode characters beyond the basic set Win-12... . If such characters appear in the source, they would be removed with this script. hth, vbr -- <http://forum.pspad.com/read.php?2,66273,66284> PSPad freeware editor http://www.pspad.com
