Compare (Word Processing)




This “Compare” command compares the text body of the two frontmost AppleWorks word processing documents, hilighting the next difference in each.



This is one of 40 features of the Enhancement Pack for AppleWorks.


The “Compare” command is in the Word Processing sub-menu of AppleWorks Scripts Menu.

Select a starting character or word in each of the two front documents. The text in the selection should be the same in each document. Select Word Processing Compare from the Scripts menu to find the next character in each document that does not match. When located, it will beep and select the difference in each document. You can then make any changes, select another starting point and run the command again.

If you receive a modified copy of a word processing document, “Compare” helps you locate the changes made compared to your original.

This command does not compare graphic objects or frames that may be in the text body of each document. It will, however, hilight a frame in one document if one does not exist at the same point in the other.

If one document contains paragraphs numbered by AppleWorks paragraph labels, but the other is numbered explicitly with text, then you should run the “Convert Labels” command first to convert one of the documents.

A future version of this script might include a user interface to ignore particular words. Please make any suggestions.

This script is locked so you can’t view the code. However, below is an excerpt of some important lines:

set text1 to (text start1 thru end1 in text body of doc1) as text
set text2 to (text start2 thru end2 in text body of doc2) as text
if text1 is not text2 then
   repeat with charN from 1 to thisChunkLength
     considering case
       if character charN in text1 is not character charN in text2 then
         exit repeat
       end if
     end considering
   end repeat
   select character (start2 + charN - 1) in text body of doc2
   select character (start1 + charN - 1) in text body of doc1
   set differenceFound to true
   exit repeat
end if

Operates on the front two documents, which must be a word processing documents.

This script works with AppleWorks 6 and AppleWorks 5.

Only registered users are permitted to edit the supplied files.

This script is included in the Enhancement Pack for AppleWorks, not supplied separately.

© 2000 BareFeetWare