Tagged: Bookmark list macro
- AuthorPosts
- August 27, 2013 at 11:32 am #11309ldmParticipant
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
August 27, 2013 at 4:57 pm #11312Yutaka EmuraKeymasterHello,
Currently, there is no built-in list for bookmarks. However, you can write a macro to enumerate all bookmarks and create a menu. Thanks!
August 28, 2013 at 10:02 am #11315ldmParticipantcould you help to write such macro?
August 28, 2013 at 2:30 pm #11318Yutaka EmuraKeymasterSure. Please wait for a while. I will write again when I become available.
Thanks!
September 7, 2013 at 5:21 am #11320Yutaka EmuraKeymasterHere 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 );
}September 16, 2013 at 6:10 am #12098ldmParticipantIn the drop-down menu, how can I see line contents instead of line numbers?
October 1, 2013 at 3:52 am #16951StefanParticipant>>> 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 ); }
- AuthorPosts
- You must be logged in to reply to this topic.