In checking "Use V8 as JavaScript engine" condition, some macros recorded in the same condition cannot run successfully

151 Views Asked by At

I checked the box Use V8 as JavaScript engine.

The demo.txt could be:

"date": "2019-11-22T20:49:21"
"text": ""

"date": "2019-11-22T20:49:24"
"text": ""

I record the macros that replace \n\n by \n, then I save the macros as Delete redundant newlines.jsee.

document.selection.Replace("\\n\\n","\\n",eeReplaceAll | eeFindReplaceRegExp,0);

But, when I run the .jsee for the same demo.txt, here comes the V8 nesting issues occured warning.

enter image description here

enter image description here

By the way, this problem have not happen in the unchecked case.

What's wrong?

I don't know too much about the JavaScript, so I don't know how to upgrade(or fix) the macros recorded in the case of unchecking Use V8 as JavaScript engine option.

And another quetion, can I set breakpoints for macros files for which help me optimize the macros?

1

There are 1 best solutions below

0
TM1 On

I assume that you are using EMEDITOR PROFESSIONAL. According to the manufacturer page EMEDITOR FREE V21.4 "Record and Run only, no scriptable macros". official website

Destruction to your second question, I use "alert" to stop the script at a certain position or to display a certain value of a variable at a position. Also the line "Redraw = false;" is commented out (//) for debugging. e.g.

if (....){
    ....
    alert("debug loop true")
}else{
    ...
    alert("debug loop else")
}

enter image description here

To the first question, I think I read (can't find the article right now) that the Macro Recorder records in javascript as before (not V8). As you wrote, unchecking "Use V8 as JavaScript engine".

For a simple test, copy the line "alert(" Hello EmEditor")" to the clipboard and then select "Run Clipboard" from the macro menu. If successful, a small window will be displayed. In my environment it is also necessary that the saved script runs first through the following steps:

  • Menu Macro

    • Customize...
  • My Macros

    • Add (select Macro file)

This is necessary for security reasons.