- AuthorPosts
- October 4, 2008 at 10:24 pm #6314StefanParticipant
Select text to next bookmark (VBScript)
Provided “as is”. No guaranty.
Test first on non important documents! I am no programmer.
Please comment below how it works.See EmEditor Help for how to use macros. Here’s an short help:
1.) Save the code between 8< and >8 -lines as text file “somename.vbee” in EmEditor folder
2.) use Menu “Macros > Select…” and choose this somename.vbee as current default macro
3.) go to where you want to start the selection (try first on an test document!)
4.) go to where you want to end the selection
5.) press F4
You’re done.———–8<---------------8<-----------
#title = Select to bookmark
#tooltip = Select text to next bookmark
'// first set an bookmark at start- or end-line
'// then go to the other end of your documnet and execute this macro to select to bookmark.
Set WshShell = CreateObject( "WScript.Shell" )
myTitle = "DEBUG: Select to "
StartLine = document.selection.GetActivePointY (eePosView)
'n = WshShell.Popup( "StartLine start " & StartLine, 5, myTitle, 0 )
FindNextBookmark = document.selection.NextBookmark
'n = WshShell.Popup( "FindNextBookmark " & FindNextBookmark, 5, myTitle, 0 )
FindPrevBookmark = document.selection.PreviousBookmark
'n = WshShell.Popup( "FindPrevBookmark " & FindPrevBookmark, 5, myTitle, 0 )
If FindNextBookmark = TRUE THEN
NextBookmark = document.selection.GetActivePointY (eePosView)
'n = WshShell.Popup( "NextBookmark " & NextBookmark, 5, myTitle, 0 )
Amount = NextBookmark - StartLine
'document.selection.SelectLine
'n = WshShell.Popup( "Amount " & Amount, 5, myTitle, 0 )
document.selection.SetActivePoint eePosView, 1, StartLine
document.selection.LineDown TRUE, Amount
ELSEIf FindPrevBookmark = TRUE THEN
NextBookmark = document.selection.GetActivePointY (eePosView)
'n = WshShell.Popup( "NextBookmark " & NextBookmark, 5, myTitle, 0 )
Amount = StartLine - NextBookmark
'document.selection.SelectLine
'n = WshShell.Popup( "Amount " & Amount, 5, myTitle, 0 )
document.selection.SetActivePoint eePosView, 1, StartLine
document.selection.LineUp TRUE, Amount
ELSE
n = WshShell.Popup( "No Bookmark found ", 5, myTitle, 0 )
end IF
———–>8—————>8———–
Note:
all “‘n = WshShell.Popup(” -lines can be deleted. They are for debugging issue only.Possible problem:
if there are other bookmarks already before
you could get unespected result.
Currently i see no “bookmark overview dialog” to list all currently used bookmarks.Enjoy
StefanComments and improvement suggestion welcome.
November 12, 2008 at 12:22 pm #6571saphireMemberIt seems do not work on Chinese Word!
How do i use marcos to specify WrapByChar and set margins(ex:75)?
——————————————————–
Sorry!
I post on wrong Subject. - AuthorPosts
- You must be logged in to reply to this topic.