vbr: -------------------------------------------------------------------------------- icek: -------------------------------------------------------------------------------- Hello,
I'm a new user of PSPad and I don't know how to make scripts. In an XML file I'd like to search the following tags : <sequence>50</sequence> <sequence>60</sequence> <sequence>65</sequence> ... <sequence>n</sequence> and rewrite properly the increment <sequence>1</sequence> <sequence>2</sequence> <sequence>3</sequence> ... <sequence>n</sequence> I guess that I have to use search/replace but I don't know the syntax. May someone help me please? Thanks in advance. David -------------------------------------------------------------------------------- Hi, as far a I know, this is not available in the builtin replace functionality. You can use my rather hackish script addon http://www.vbr.wz.cz/pspad/poor-man-s-REplace.html Be sure to make a backup of the source data, especially on larger files and with invalid input the mentioned javascript can cause problems. (Some caveats are on the homepage too.) The pattern for replace would be e.g.: cite: -------------------------------------------------------------------------------- /(<sequence>)(\d+)(<\/sequence>)/gi, function(match, paren1, paren2, paren3){globParamArr[0]=0; globParamArr[globParamArr.length] = globParamArr[globParamArr.length-1] +1; return paren1+globParamArr[globParamArr.length-1]+paren3;} -------------------------------------------------------------------------------- To reset the counter you have to use "recompile scripts" in the Scripts menu (the pattern will be cleared too.) Or you can use the *eval* item in the script menu with the following: cite: -------------------------------------------------------------------------------- globParamArr = new Array();-------------------------------------------------------------------------------- hth, vbr -------------------------------------------------------------------------------- Yeah, I agree with you. -- [url=http://www.MmoRiftGold.com]Rift Gold[/url] [url=http://www.MmoRiftGold.com]Cheap Rift Platinum[/url] [url=http://www.MmoRiftGold.com]Buy Rift Platinum[/url] [url=http://www.MmoRiftGold.com]Rift Platinum[/url] <http://forum.pspad.com/read.php?2,56512,56524> PSPad freeware editor http://www.pspad.com
