Viewing 2 posts - 1 through 2 (of 2 total)
  • Author
    Posts
  • #4005
    muskoka
    Participant

    Is there a simple way to delete all lines between two boomarks? A function to cut and another for copy between bookmarks would also be useful.

    #4006
    Yutaka Emura
    Keymaster

    You can use the following macros (JavaScript):


    // Delete lines between bookmarks
    bSuccess = false;
    if( document.selection.NextBookmark() ){
    y1 = document.selection.GetActivePointY( eePosLogical );
    if( document.selection.NextBookmark() ){
    y2 = document.selection.GetActivePointY( eePosLogical );
    document.selection.SetActivePoint( eePosLogical, 1, y1, false );
    document.selection.SetActivePoint( eePosLogical, 1, y2, true );
    document.selection.Delete(1);
    bSuccess = true;
    }
    }
    if( !bSuccess ){
    alert( "Cannot find bookmarks. The cursor position must be above both bookmarks before you run this macro." )
    }

    // Copy lines between bookmarks
    bSuccess = false;
    if( document.selection.NextBookmark() ){
    y1 = document.selection.GetActivePointY( eePosLogical );
    if( document.selection.NextBookmark() ){
    y2 = document.selection.GetActivePointY( eePosLogical );
    document.selection.SetActivePoint( eePosLogical, 1, y1, false );
    document.selection.SetActivePoint( eePosLogical, 1, y2, true );
    document.selection.Copy( eeCopyUnicode );
    bSuccess = true;
    }
    }
    if( !bSuccess ){
    alert( "Cannot find bookmarks. The cursor position must be above both bookmarks before you run this macro." )
    }

    // Cut lines between bookmarks
    bSuccess = false;
    if( document.selection.NextBookmark() ){
    y1 = document.selection.GetActivePointY( eePosLogical );
    if( document.selection.NextBookmark() ){
    y2 = document.selection.GetActivePointY( eePosLogical );
    document.selection.SetActivePoint( eePosLogical, 1, y1, false );
    document.selection.SetActivePoint( eePosLogical, 1, y2, true );
    document.selection.Cut();
    bSuccess = true;
    }
    }
    if( !bSuccess ){
    alert( "Cannot find bookmarks. The cursor position must be above both bookmarks before you run this macro." )
    }

Viewing 2 posts - 1 through 2 (of 2 total)
  • You must be logged in to reply to this topic.