nisus.com
https://www.nisus.com/forum/

Bookmarking through macros
https://www.nisus.com/forum/viewtopic.php?f=17&t=2305
Page 1 of 1

Author:  js [ 2007-06-15 00:58:00 ]
Post subject:  Bookmarking through macros

I am still wondering, in beta 2, that you cannot bookmark the insertion point.

Within a macro you often want to start some process from the insertion point and afterwards get back there. You could do this with the bookmark function, like

Code:
Bookmark as "myStart"
... actual macro
Select bookmark "myStart"
Remove Bookmark


This does not properly work under 3 conditions:
1) if the starting point is just the insertion point rather than an actual selection
2) starting with an non-contiguous selection
3) if the selection is within a text that is already bookmarked. (In spite of giving a clear unambiguous instruction which bookmark you want to delete, you are asked by the program which one it should be: the inner or the outer. I think this is less than perfect.

As to 1) I don't get the Nisus point of view either. What is so difficult to make a selection zero characters wide.
And as to 2) If non-contiguous selections cannot be handled why not consider the first chunk only in this case.
I tried to handle these problems with the new additions to beta 2, (selection insertion and selection length) and it works, but this is unexpectedly slower than with bookmarks.

A last point on the same subject: I think it would be extremely helpful if giving a new bookmark the name of an old bookmark would replace the old by the new. Lets say I work in a long document and I arrive at a point which I bookmark as "I_am_here_now", then a macro doing this could be applied along with the progress of the work.

Author:  martin [ 2007-06-15 12:57:38 ]
Post subject:  Re: Bookmarking through macros

js wrote:
This does not properly work under 3 conditions:
1) if the starting point is just the insertion point rather than an actual selection

Correct, you cannot have an empty bookmark (eg: zero characters). Honestly I don't see any situation where adding, selecting, and finally removing a bookmark would be faster than the following:

Code:
$selStart = Selection Location
$selLength = Selection Length
# do whatever
Set Selection $selStart, $selLength

Bookmarks are much heavier than a few selection reads/writes.

Quote:
3) if the selection is within a text that is already bookmarked. (In spite of giving a clear unambiguous instruction which bookmark you want to delete, you are asked by the program which one it should be: the inner or the outer. I think this is less than perfect.

I will file a feature request that the Remove Bookmark command accept a parameter that specifies the bookmark name.

Author:  mountainman [ 2007-07-04 22:11:48 ]
Post subject: 

I too noticed that you cannot bookmark an insertion point (Nisus Writer Classic could do this). I wanted a macro to use when editing long files. What happens is that frequently I think of something I should check the whole file for, and stop editing to do it. But in a long file it's not easy to find your way back to where you were. So I wrote a macro to do this. Maybe all or part of this will be useful for others, so I'll post it here.

$exists = Select Bookmark “Goback”
if $exists == 0
Find “.”, “Er”
Bookmark As “Goback”
else
Remove Bookmark
Select End
end

This looks for a bookmark called Goback. If not found, it sets a bookmark (I chose the previous character arbitrarily). If found, it deletes the bookmark, and you end up with the cursor back at the original location.

Author:  Derick [ 2007-07-10 19:08:23 ]
Post subject: 

I've set up a pair of macros to emulate the Quickmark behavior in WordPerfect (previously discussed here: http://www.nisus.com/forum/viewtopic.php?t=2387)

1) Set Quickmark -- consisting of the following two lines:

Find “.”, “Er”
Bookmark As “Quickmark"

2) Goto Quickmark -- consisting of the following two lines:

Select Bookmark “Quickmark”
Scroll to Selection

After trying mountainman's single / toggle macro, I decided I was more comfortable with separate Set and Goto macros.

Page 1 of 1 All times are UTC - 8 hours
Powered by phpBB® Forum Software © phpBB Group
http://www.phpbb.com/