You are here: PSPad forum > English discussion forum > How to change comment for MS-DOS batch?

How to change comment for MS-DOS batch?

#1 How to change comment for MS-DOS batch?

Posted by: bege | Date: 2014-09-03 13:28 | IP: IP Logged

Hi,
I am new to PSPad and like it at a first glance.
Is there a way to change the comment (ctrl+shift+A) for MS-DOS batch from "REM" to "::" ?
Thank you very much.

Options: Reply | Quote | Up ^


#2 Re: How to change comment for MS-DOS batch?

Posted by: pspad | Date: 2014-09-03 14:11 | IP: IP Logged

Hello.
PSPad 4.5.8 works with :: comment in MSDos batch files

Options: Reply | Quote | Up ^


#3 Re: How to change comment for MS-DOS batch?

Posted by: Stefan | Date: 2014-09-03 18:52 | IP: IP Logged

Jan, the question was how to change the shortcut behaviour
to insert ':: ' instead of 'REM ' by pressing Ctrl+Shift+A

 
Since this highlighter is build-in and there is no syntax file
existent, we can't change this setting.

 
But that is not really an issue, as ':: ' is a kind of pseudo comment only
by abuse jumps marks and not the official comment sign.

 
However, one can change this by creating an own user highlighter
and use there that as comment sign what one want.

 
Another way is to use an script to modify line comments
and execute that by an shortcut similar to Ctrl+Shift+A.

As here this JavaScript which can be executed by Ctrl+Alt+A:

// Add or remove leading MS-Dos pseudo comment signs ::

var module_name = "InsertMSDosComments";
var module_ver = "1.0";
function Init(){
addMenuItem("Add/Remove MS-Dos Comment ::","", "MSDosLineComments", "Ctrl+Alt+A");
}
function MSDosLineComments(){
var doc, sel, LArr, i, line;
doc = newEditor();
doc.assignActiveEditor();
sel = doc.selText();
LArr = sel.split("\n");
for (i in LArr) {
line = LArr[i];
if (line.substr(0,3) == ":: ") {
line = line.substr(3);
}else{
line = ":: "+line;
}
doc.selText(line);
}
}

 
Note: this version works only with fully selected lines.

 

 

--
Stefan (pleased user since 1722)
Do you know you can spend Jan a beer? (click here)
Inofficial FAQs + Infos + Special Settings

Options: Reply | Quote | Up ^






Editor PSPad - freeware editor, © 2001 - 2024 Jan Fiala, Hosted by Webhosting TOJEONO.CZ, design by WebDesign PAY & SOFT, code Petr Dvořák, Privacy policy and GDPR