Reply to topic  [ 3 posts ] 
Compare Documents macro: suggestion to preload Find dialog 
Author Message

Joined: 2006-03-12 12:32:47
Posts: 138
I have a suggestion for improving the excellent Compare Documents macro that's preinstalled with NWP (originally written by Kino).

Append the following two steps to the macro:
Find '(AnyText)(Or)(AnyText)', 'euW!'
Menu 'Find:Show Find…'

This opens a Find dialog pre-loaded with criteria to find any text colored pink or green by the Compare Documents macro. This makes it easier to find all changed text.

2017-09-07 17:18:48

Joined: 2008-05-17 04:02:32
Posts: 400
Thank you very much for the excellent suggestion. Yes, it would be hard to find all changed texts when the target document is large. To make the task easier, using the attribute sensitive search would be a nice idea. However, personally, I’d like to use the Find panel for something else.

So I wrote a macro (not tested sufficiently, sorry) which adds bookmarks to all texts having some background colour (i. e. not white background colour).

### Add Bookmak to Texts Having Background Colors ###

Require Pro Version '2.1'

$doc =
if $doc == @undefined
   exit 'No open document. Exiting...'

$white = Color.white
$withBGC =

foreach $text in $doc.allTexts
   if $text.length
      $i = 0
      while $i < $text.length
         $bgc = $text.displayAttributesAtIndex($i).textBackgroundColor
         $range = $text.rangeOfDisplayAttributesAtIndex($i)
         if $bgc != $white
            $sel =$text, $range)
         $i = $range.bound

if ! $withBGC.count
   exit 'No text having background colors found. Exiting...'

Push Target Selection $withBGC
   Add Bookmark
Pop Target Selection

Set Navigator Mode 'Bookmarks by Location'
Set Navigator Shown @true

### end of macro ###

File comment: Macro file [4.83 KiB]
Downloaded 21 times

Note that you can change the highlighting color of “Bookmarked” texts in NWP’s Preferences > Appearance > Customized colors > Marked Text > Bookmarked (autoname).

2017-09-10 10:18:53

Joined: 2006-03-12 12:32:47
Posts: 138
Excellent idea, Kino-san! Thanks!

2017-09-10 14:33:56
Display posts from previous:  Sort by  
Reply to topic   [ 3 posts ] 

Who is online

Users browsing this forum: No registered users and 1 guest

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:  
Powered by phpBB® Forum Software © phpBB Group
Designed by ST Software