Reply to topic  [ 5 posts ] 
Top of Page Macro? 
Author Message

Joined: 2010-01-06 10:58:07
Posts: 39
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


2010-02-12 06:47:43
Profile

Joined: 2008-05-17 04:02:32
Posts: 400
Does this macro meet your needs?
Code:
$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


2010-02-12 07:13:52
Profile

Joined: 2010-01-06 10:58:07
Posts: 39
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?


2010-02-12 07:35:05
Profile

Joined: 2008-05-17 04:02:32
Posts: 400
Unfortunately that is not feasible because it is impossible for a macro to know which portion of a document is actually visible.


2010-02-12 07:57:55
Profile

Joined: 2010-01-06 10:58:07
Posts: 39
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


2010-02-12 10:21:44
Profile
Display posts from previous:  Sort by  
Reply to topic   [ 5 posts ] 

Who is online

Users browsing this forum: No registered users and 2 guests


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot post attachments in this forum

Search for:
Jump to:  
cron
Powered by phpBB® Forum Software © phpBB Group
Designed by ST Software