<http://forum.pspad.com/read.php?f=2&i=10443&t=10426> 
----------------------------------------------------------------

Thank you very much, this works fine for me. I use this function for
"permanent bookmarks", perhaps it's useful for others too. I've some
big(some MB)  text-"databases" in which i've placed some bookmarks e.g.
<!-- 1 -->, <!-- 2 --> ...
With this small scripts (and the GetStrPos from above) I can access these
bookmarks very quickly:

function GotoBookmark(sBookmark)
    pattern = "<!-- " & sBookmark & " -->"
    msgbox pattern
    Set editor = newEditor()
    editor.assignActiveEditor
    editor.command("ecLineStart") 
    aPos = GetStrPos(pattern, True)
    If IsArray(aPos) Then
        '// Found a match, now move caret to match.
        editor.setCaretPos aPos(0), aPos(1)
    Else 
        MsgBox "No match found.", 0, module_name & "::FindPos"
    End If
    Set editor = nothing
end function

sub Bookmark0 : GotoBookmark(0) : end sub
sub Bookmark1 : GotoBookmark(1) : end sub
sub Bookmark2 : GotoBookmark(2) : end sub
sub Bookmark3 : GotoBookmark(3) : end sub
sub Bookmark4 : GotoBookmark(4) : end sub
sub Bookmark5 : GotoBookmark(5) : end sub
sub Bookmark6 : GotoBookmark(6) : end sub
sub Bookmark7 : GotoBookmark(7) : end sub
sub Bookmark8 : GotoBookmark(8) : end sub
sub Bookmark9 : GotoBookmark(9) : end sub

sub Init
  addMenuItem "Bookmark 1","Bookmarks", "Bookmark1",
"Shift+Ctrl+1"
  addMenuItem "Bookmark 2","Bookmarks", "Bookmark2",
"Shift+Ctrl+2"
  addMenuItem "Bookmark 3","Bookmarks", "Bookmark3",
"Shift+Ctrl+3"
  addMenuItem "Bookmark 4","Bookmarks", "Bookmark4",
"Shift+Ctrl+4"
  addMenuItem "Bookmark 5","Bookmarks", "Bookmark5",
"Shift+Ctrl+5"
  addMenuItem "Bookmark 6","Bookmarks", "Bookmark6",
"Shift+Ctrl+6"
  addMenuItem "Bookmark 7","Bookmarks", "Bookmark7",
"Shift+Ctrl+7"
  addMenuItem "Bookmark 8","Bookmarks", "Bookmark8",
"Shift+Ctrl+8"
  addMenuItem "Bookmark 9","Bookmarks", "Bookmark9",
"Shift+Ctrl+9"
  addMenuItem "Bookmark 0","Bookmarks", "Bookmark0",
"Shift+Ctrl+0"
end sub


I've seen the nice option of PSPad to save bookmarks between sessions,
but these bookmarks are "line oriented". If I change the document
outside from PSPad, these bookmarks will be lost/changed so I need still
my "embedded bookmarks"

-- 
PSPad freeware editor http://www.pspad.com

Reply via email to