#3907
Yutaka Emura
Keymaster

If you have EmEditor Professional, you can write a macro like this (JavaScript):

```var bEmpty = false;
if( document.selection.IsEmpty ){
editor.ExecuteCommandByID(4154);  // Select line if not selected
bEmpty = true;
}
editor.ExecuteCommandByID(4371);   // Comment.  Use 4372 for Uncomment.
if( bEmpty ){
document.selection.Collapse();
}```

This macro can comment selected lines if selected, or comment the current line if not selected.

Then you can customize menus to insert this macro to anywhere you would like.