Fixed it: The problem was "++nCount", which is not allowed, it has to be "nCount++".
It's actually SAD and unfortunate that the error reporting works like this.
For the JS code below, it only says " '}' Expected".
It should and needs to report the LINE at the very least, and PREFERABLY a column at or near the error.
Code: Select all
var nTabColumn = StrToInt (InputBox ("Tab To Column", "Tab To Column?", "0"));
if ((nTabColumn > 0) && (nTabColumn < 200)) {
Document.BeginUpdate();
Document.BeginUndo();
var nCursorX = Document.CursorX;
var nCount = 0;
while ((Document.CursorX < nCursorX) && (nCount < 200)) {
Document.InsertText(" ");
++nCount;
}
Document.EndUndo();
Document.EndUpdate();
}
So I changed InputBox (BACK) to: InputBox ("Tab To Column", "Tab To Column?", "0")
which is what I had initially, but I removed the default value "0" because I looked at the help
and InputBox says there is no Default Value parameter: (so WTF is up with that??)
InputBox
Syntax
InputBox(const wsCaptions, wsPrompt: String): String
Description
Display a dialog box to obtain user input.
Example
var
s: string;
begin
s := InputBox('Name', 'Enter a user name:');
...
end.
Code: Select all
var sTabColumn = InputBox ("Tab To Column", "Tab To Column?");
var nTabColumn = StrToInt (sTabColumn);
//if ((nTabColumn > 0) && (nTabColumn < 200)) {
//Document.BeginUpdate();
//Document.BeginUndo();
var nCursorX = Document.CursorX;
var nCount = 0;
// while ((Document.CursorX < nCursorX) && (nCount < 200)) {
Document.InsertText(" ");
++nCount;
// }
//Document.EndUndo();
//Document.EndUpdate();
//}