EmEditor (text editor) Forum Index
   Macro Samples
     AllEdit
Register To Post

Threaded | Oldest First Previous Topic | Next Topic | Bottom
Poster Thread
PaperPlate
Posted on: 5/21/2008 8:39 am
Just popping in
Joined: 4/23/2008
From:
Posts: 8
AllEdit
This macro must follow either a FindInFiles result or after using the FindALl macro (or a macro with similar outputs). You can edit the output of either of these functions and then use this macro to "dump" your edits back in. It uses the tags to link back to the original document and insert the changes to the line.

Note: If your file is not saved prior to running the macro (or prior to running the FindInFiles or FindAll macro) you could be dumping to the wrong location. If you're deleting a whole line from the output you still need the tag, with the blank/s to the right of it, to dump in the blank at the location.

Save as a Javascript (.js) file:
Quote:
docSearch = editor.ActiveDocument;
docSearch.Activate();
docSearch.selection.StartOfDocument();

docSearch.selection.SelectLine();
test = docSearch.selection.Text;
if (test.charAt(1) != ":") {
alert("This macro must be run after an All; in the All tab.");
docSearch.selection.StartOfDocument();
Quit();
}

y = 1;
do {
docSearch.selection.SetActivePoint( eePosLogical, 1, y );
if( y != docSearch.selection.GetActivePointY( eePosLogical ) ) break;

docSearch.selection.SelectLine();

sLine = docSearch.selection.Text;
sLineLimiter = (sLine.indexOf(":", 2) + 2);
sLine = sLine.substr(sLineLimiter);

docSearch.selection.StartOfLine();
editor.ExecuteCommandByID(4147);

document.selection.SelectLine();
document.write(sLine);

docSearch.Activate();
y++;
} while( true );

Threaded | Oldest First Previous Topic | Next Topic | Top


Register To Post
 
English čeština Deutsch español français italiano 日本語 한국어 Русский 简体中文 繁體中文