Page 1 of 1
Top of Page Macro?
Posted: 2010-02-12 06:47:43
by bjast
Perhaps it exists already, but is there a way to write a macro to place the cursor at the top of the present page?
Thanks
Re: Top of Page Macro?
Posted: 2010-02-12 07:13:52
by Kino
Does this macro meet your needs?
Code: Select all
$sel = TextSelection.active
if $sel == undefined
exit
end
$i = $sel.location
if $i == $sel.text.length
if $i != 0
$i -= 1
end
end
$n = $sel.text.pageNumberAtIndex $i
Select Page $n
Select Start
Re: Top of Page Macro?
Posted: 2010-02-12 07:35:05
by bjast
Thanks Kino for a quick reply to this.
It kinda does what I had in mind, but it doesn't always go to the top of the page - at least as the page appears on the screen. Perhaps this is asking too much of NWP.
What I was hoping for was to have the cursor go to the top of screen from any place in the open document. For instance if the cursor was presently at, say, two thirds of the way down the screen, the macro would move the cursor to the top of the screen, rather than the top of the page - tricky, I admit.
Any ideas?
Re: Top of Page Macro?
Posted: 2010-02-12 07:57:55
by Kino
Unfortunately that is not feasible because it is impossible for a macro to know which portion of a document is actually visible.
Re: Top of Page Macro?
Posted: 2010-02-12 10:21:44
by bjast
That's what I was afraid of. But I can use the one you sent me, as it get closer than anything that I could come up with.
Thanks