therium:
--------------------------------------------------------------------------------
Hi,
I have about 10 files where I have to make about 10 different replaces,
replacing "smart double quotes" with low-ascii equivalent. I would like to just
run a single command containing all these replaces when I first edit a file. The
file is markdown and I will also be using regex to do other replaces like to
convert footnotes to Markdown footnotes, like: 

"[24]" converts to "[^ch01-24]".

Can PSpad do this some how? I don't want to use the macro recorder because if I
get one thing wrong, I have to re-record from the beginning again, and that's a
PITA. 

Or is there an addon/extension to do this in PSPad?

Thanks.
--------------------------------------------------------------------------------


Hi,
You can use a custom script for such repeated tasks.
Just check:
Program settings: [x] System integration: Integrated scripting support (WSH)

There is a documentation in the PSPad folder
...\PSPad\Scripting.rtf
including a sample file in vbscript for running a converter on all open files;
You can group the respecive files with sessions or as a project.

Alternatively, if you prefer to have a single batch-like file to manage such
conversions, it can be via scripting entirely.
Just save the javascript (preferably utf-8 encoded) e.g. as:

...\PSPad\Script\JScript\batch_conversion_re.js

cite:
--------------------------------------------------------------------------------
var module_name = "BatchConversionRE";
var module_ver = "1";

function reBatchReplaceMultiple(){
var fileList =
["C:\\path\\to\\a.txt","C:\\path\\to\\z.txt","C:\\path\\to\\b.txt","C:\\path\\to
\\c.txt"]; // paths with double backslashes
for (var i=0; i < fileList.length; i++){
var filePath = fileList[i];
var actEd = newEditor();
try{
actEd.openFile(filePath);
}catch(e){
continue; // skip missing files
}
var outputTxt = actEd.text(); // replacements on the whole text 
//series of replacements
outputTxt = outputTxt.replace(/[“”„“]/gi, "\"");//quote as needed:
slashes in search patterns  \/  quotes in replacement patterns: \"
outputTxt = outputTxt.replace(/[â€

Odpovedet emailem