EmEditor (text editor) Forum Index Macro Samples
Learning by doing: Loop through all lines | Register To Post |
| Flat | Previous Topic | Next Topic |
| Poster | Thread |
|---|---|
| Stefan | Posted on: 11/2/2011 1:12 pm |
Home away from home ![]() ![]() Joined: 7/14/2008 From: Germany, EU Posts: 285 |
Re: Learning by doing: Loop through SELECTED lines Some examples for <Your Code> section:
////Delete start of line (Remove first sign/char): redraw = false; document.selection.SetActivePoint( eePosLogical, 1, Line ); str = document.GetLine( Line ); if (str != "") { document.selection.StartOfLine(); document.selection.Delete(); } ////Delete end of line (Remove last sign/char): redraw = false; document.selection.SetActivePoint( eePosLogical, 1, Line ); str = document.GetLine( Line ); if (str != "") { document.selection.EndOfLine(); document.selection.DeleteLeft(); } ######################################## However, for just this task there would be an easier solution then such an big script as shown above: //Remove first sign from selected lines redraw = false; document.selection.Replace("^.","", eeReplaceSelOnly | eeReplaceAll | eeFindReplaceRegExp); document.HighlightFind = false; //Remove last sign from selected lines redraw = false; document.selection.Replace(".$","", eeReplaceSelOnly | eeReplaceAll | eeFindReplaceRegExp); document.HighlightFind = false; |
| Flat | Previous Topic | Next Topic |
| Subject | Poster | Date |
|---|---|---|
| |
Stefan | 11/2/2011 3:54 am |
| |
Stefan | 11/2/2011 12:45 pm |
| » |
Stefan | 11/2/2011 1:12 pm |
| Register To Post | |


