Viewing 7 posts - 1 through 7 (of 7 total)
  • Author
    Posts
  • #11309
    ldm
    Participant

    Hi All,

    How can I see ALL my Bookmarks in the current Document/File? Is there a drop-down list of them or just a Toolbar (similar to Markers)?

    Thank you

    #11312
    Yutaka Emura
    Keymaster

    Hello,

    Currently, there is no built-in list for bookmarks. However, you can write a macro to enumerate all bookmarks and create a menu. Thanks!

    #11315
    ldm
    Participant

    could you help to write such macro?

    #11318
    Yutaka Emura
    Keymaster

    Sure. Please wait for a while. I will write again when I become available.

    Thanks!

    #11320
    Yutaka Emura
    Keymaster

    Here is the code:

    menu = CreatePopupMenu();
    document.selection.StartOfDocument();

    while( document.selection.NextBookmark() ) {
    n = document.selection.GetActivePointY( eePosLogical );
    s = "Line " + n;
    menu.Add( s, n );
    }
    result = menu.Track( 0 );
    if( result > 0 ) {
    document.selection.SetActivePoint( eePosLogical, 1, result );
    }

    #12098
    ldm
    Participant

    In the drop-down menu, how can I see line contents instead of line numbers?

    #16951
    Stefan
    Participant

    >>> In the drop-down menu, how can I see line contents instead of line numbers?

    To see line numbers and line contents, change this on the code:
    FROM:
    s = “Line ” + n;
    TO:
    L = document.GetLine(n); //line content
    L = L.substring(0,80); //shorten content
    s = “Line ” + n + “: ” + L;

    .

    .

    Here is a slightly altered code from me:

    CurrentLine = document.selection.GetActivePointY( eePosLogical );
    
    menu = CreatePopupMenu();
    count = 0;
    document.selection.SetActivePoint( eePosLogical, 1, 2 );
    if (document.selection.PreviousBookmark()){	AddToList(); }
    while( document.selection.NextBookmark() ){	AddToList(); count++; if (count > 20) break;}
    
    function AddToList(){
    		n = document.selection.GetActivePointY( eePosLogical );
    		L = document.GetLine(n); //line content
    		L = L.substring(0,80); //shorten content
    		s = "Line " + n + ": " + L;
    		menu.Add( s, n );
    }
    
    //back to that line where this script was executed:
    document.selection.SetActivePoint( eePosLogical, 1, CurrentLine );
    
    //show bookmarks list:
    result = menu.Track( 0 );
    if( result > 0 ) {
    		document.selection.SetActivePoint( eePosLogical, 1, result );
    }
    	
Viewing 7 posts - 1 through 7 (of 7 total)
  • You must be logged in to reply to this topic.