fred_gaou:
--------------------------------------------------------------------------------
Hi,
I know phReplace but it doesn't save multiple profiles, it just restores the
last searh. Yet I'd like to make some different scripts where I can easily add
multiple regexp.
I did try to create one (see below) but I'm a noob and it doesn't work (cause
conspicuous dirty code). So based on this template, please could you help me to
get THE script? ;-)
...
--------------------------------------------------------------------------------
Hi,
I am currently not going to use VBS, you will have to wait for someone else with
that; but supposing I got the function of your planned script correctly, you may
try something allong the lines of this javascript. It performs the replacements
on the whole text of the active editor window.
(you can open the script file by simultaneously clicking left and right mouse
button over the script menu item, hence this function is not included here.
hth,
vbr
cite:
--------------------------------------------------------------------------------
//////////////////// ... PSPad\script\JScript\replaceMult.js
////////////////////////
var module_name = "replaceMultiple";
var module_ver = "1";
function reReplaceMultiple(){
// performs multiple replacements on the whole text
if (editorsCount()<1){return;}
var actEd = newEditor();
actEd.assignActiveEditor();
var inputTxt = actEd.text();
var outputTxt = inputTxt;
//series of replacements
outputTxt = outputTxt.replace(/-+ page [0-9]+-+/gi, "");
outputTxt = outputTxt.replace(/example/gi, "");
outputTxt = outputTxt.replace(/etc\./gi, "");
actEd.text(outputTxt);
}
function Init(){
addMenuItem("replace multiple", "", "reReplaceMultiple","Ctrl+Alt+Shift+R");
}
--------------------------------------------------------------------------------
--
<http://forum.pspad.com/read.php?2,48923,48931>
PSPad freeware editor http://www.pspad.com