[svn.haxx.se] · SVN Dev · SVN Users · SVN Org · TSVN Dev · TSVN Users · Subclipse Dev · Subclipse Users · this month's index

Make diff-doc.js use Merge instead of Compare for documents with existing Track Changes.

From: Jared Silva <jayrod_at_gmail.com>
Date: 2006-11-01 21:15:56 CET

In Word 2003, diff-doc.js will fail when using Compare for documents
with existing Track Changes:

Windows Script Host
Script: ...\diff-doc.js
Line: 44
Char: 1
Error: Command failed
Code: 800A1066
Source: Microsoft Word

Personally, to get a good Compare from Word I "Accept All Changes in
Document" (necessary for Compare to work) and "Delete All Comments in
Document" (Word does not Compare comments, so they only get in the
way) for both the Base and New documents. If you all can make this
happen automatically, go for it, for I know nothing of WScript.

Because, in the case when using Compare for documents with existing
Track Changes, Compare will fail, I feel Merge should be used instead
(if the above cannot be done). The following code change (with
additional comments) will do so.

Index: diff-doc.js
===================================================================
--- diff-doc.js (revision BASE)
+++ diff-doc.js (revision HEAD)
@@ -41,7 +41,16 @@
 destination = word.Documents.Open(sNewDoc);

 // Compare to the base document
-destination.Compare(sBaseDoc);
+try
+{
+ destination.Compare(sBaseDoc, "", 2);

/// "" preserves the AuthorName Variant.
/// 2 is the CompareTarget Variant. I do not know how to invoke
/// Word.WdCompareTarget.wdCompareTargetNew, so I use the value
/// instead.
/// AuthorName and CompareTarget do not need to be specified for this
/// function (already places comparison in a new document).

+ WScript.Echo("Compare:\n" + sBaseDoc + "\n" + sNewDoc);

/// Let the user know Compare was used and on what files (not needed).
/// If this line is removed, and AuthorName and CompareTarget are
/// removed from Compare, there is no change to existing Compare code.

+}
+catch(e)
+{
+ destination.Merge(sBaseDoc, 2);

/// 2 is the MergeTarget Variant. I do not know how to invoke
/// Word.WdMergeTarget.wdMergeTargetNew, so I use the value instead.
/// MergeTarget does need to be specified for this function (places
/// merge in a new document).

+ WScript.Echo("Merge:\n" + sBaseDoc + "\n" + sNewDoc);

/// Let the user know Merge was used and on what files (needed IMO).

+}

 // Show the comparison result
 if (Number(word.Version) < 12)

---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@tortoisesvn.tigris.org
For additional commands, e-mail: users-help@tortoisesvn.tigris.org
Received on Wed Nov 1 21:20:51 2006

This is an archived mail posted to the TortoiseSVN Users mailing list.

This site is subject to the Apache Privacy Policy and the Apache Public Forum Archive Policy.