Guten Tag TortoiseSVN,
am Sonntag, 21. Juni 2020 um 15:09 schrieben Sie:

> Would be great if the current approach would be reconsidered to take
> the file type to DIFF into account again. While using Word/LibreOffice
> as fallback when the original app of a format is not available makes
> sense of course, the wrong app shouldn't be chosen by default.

If anyone is interested, I simply copied the DOC-script and removed
preferring MS Word entirely. The custom script can then be configured
in the advanced DIFF-settings to be used for ODT again. Works like
before this way.

I couldn't find any easier solution like portable MS Word or non
MS-Word RTF-editor, which is as compatible as I need it etc.

Mit freundlichen Grüßen,

Thorsten Schöning

-- 
Thorsten Schöning       E-Mail: [email protected]
AM-SoFT IT-Systeme      http://www.AM-SoFT.de/

Telefon...........05151-  9468- 55
Fax...............05151-  9468- 88
Mobil..............0178-8 9468- 04

AM-SoFT GmbH IT-Systeme, Brandenburger Str. 7c, 31789 Hameln
AG Hannover HRB 207 694 - Geschäftsführer: Andreas Muchow

-- 
You received this message because you are subscribed to the Google Groups 
"TortoiseSVN" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
To view this discussion on the web visit 
https://groups.google.com/d/msgid/tortoisesvn/1459749207.20200728175922%40am-soft.de.
// extensions: doc;docx;docm;odt;ods
//
// TortoiseSVN Diff script for Word Doc files
//
// Copyright (C) 2004-2008, 2011-2016, 2019-2020 the TortoiseSVN team
// This file is distributed under the same license as TortoiseSVN
//
// Last commit by:
// $Author: stefankueng $
// $Date: 2020-05-01 21:07:16 +0200 (Fr., 01 Mai 2020) $
// $Rev: 28858 $
//
// Authors:
// Stefan Kueng, 2011, 2013
// Jared Silva, 2008
// Davide Orlandi and Hans-Emil Skogh, 2005
//

var objArgs, num, sBaseDoc, sNewDoc, sTempDoc, objScript, word, destination;
// Microsoft Office versions for Microsoft Windows OS
var vOffice2000 = 9;
var vOffice2002 = 10;
//var vOffice2003 = 11;
var vOffice2007 = 12;
var vOffice2013 = 15;
// WdCompareTarget
//var wdCompareTargetSelected = 0;
//var wdCompareTargetCurrent = 1;
var wdCompareTargetNew = 2;
// WdViewType
var wdMasterView = 5;
var wdNormalView = 1;
var wdOutlineView = 2;
// WdSaveOptions
var wdDoNotSaveChanges = 0;
//var wdPromptToSaveChanges = -2;
//var wdSaveChanges = -1;
var wdReadingView = 7;

objArgs = WScript.Arguments;
num = objArgs.length;
if (num < 2)
{
    WScript.Echo("Usage: [CScript | WScript] diff-doc.js base.doc new.doc");
    WScript.Quit(1);
}

sBaseDoc = objArgs(0);
sNewDoc = objArgs(1);

objScript = new ActiveXObject("Scripting.FileSystemObject");

if (!objScript.FileExists(sBaseDoc))
{
    WScript.Echo("File " + sBaseDoc + " does not exist. Cannot compare the 
documents.");
    WScript.Quit(1);
}

if (!objScript.FileExists(sNewDoc))
{
    WScript.Echo("File " + sNewDoc + " does not exist. Cannot compare the 
documents.");
    WScript.Quit(1);
}

var OO;
try
{
    OO = WScript.CreateObject("com.sun.star.ServiceManager");
}
catch (e)
{
    WScript.Echo("You must have Microsoft Word or OpenOffice installed to 
perform this operation.");
    WScript.Quit(1);
}
// Yes, OO is installed - do the diff with that one instead
var objFile = objScript.GetFile(sNewDoc);
if ((objFile.Attributes & 1) === 1)
{
    // Reset the readonly attribute
    objFile.Attributes &= ~1;
}
// Create the DesktopSet
var objDesktop = OO.createInstance("com.sun.star.frame.Desktop");
var objUriTranslator = 
OO.createInstance("com.sun.star.uri.ExternalUriReferenceTranslator");
// Adjust the paths for OO
sBaseDoc = sBaseDoc.replace(/\\/g, "/");
sBaseDoc = sBaseDoc.replace(/:/g, "|");
sBaseDoc = sBaseDoc.replace(/ /g, "%20");
sBaseDoc = sBaseDoc.replace(/#/g, "%23");
sBaseDoc = "file:///" + sBaseDoc;
sBaseDoc = objUriTranslator.translateToInternal(sBaseDoc);
sNewDoc = sNewDoc.replace(/\\/g, "/");
sNewDoc = sNewDoc.replace(/:/g, "|");
sNewDoc = sNewDoc.replace(/ /g, "%20");
sNewDoc = sNewDoc.replace(/#/g, "%23");
sNewDoc = "file:///" + sNewDoc;
sNewDoc = objUriTranslator.translateToInternal(sNewDoc);

// Open the %base document
var oPropertyValue = [];
oPropertyValue[0] = OO.Bridge_GetStruct("com.sun.star.beans.PropertyValue");
oPropertyValue[0].Name = "ShowTrackedChanges";
oPropertyValue[0].Value = true;
objDesktop.loadComponentFromURL(sNewDoc, "_blank", 0, oPropertyValue);

// Set the frame
var Frame = objDesktop.getCurrentFrame();

var dispatcher = OO.CreateInstance("com.sun.star.frame.DispatchHelper");

// Execute the comparison
dispatcher.executeDispatch(Frame, ".uno:ShowTrackedChanges", "", 0, 
oPropertyValue);
oPropertyValue[0].Name = "URL";
oPropertyValue[0].Value = sBaseDoc;
dispatcher.executeDispatch(Frame, ".uno:CompareDocuments", "", 0, 
oPropertyValue);
WScript.Quit(0);

if (parseInt(word.Version, 10) >= vOffice2007)
{
    sTempDoc = sNewDoc;
    sNewDoc = sBaseDoc;
    sBaseDoc = sTempDoc;
}

objScript = null;
word.visible = true;

// Open the new document
try
{
    destination = word.Documents.Open(sNewDoc, true, parseInt(word.Version, 10) 
< vOffice2013);
}
catch (e)
{
    try
    {
        // Open empty document to prevent bug where first Open() call fails
        word.Documents.Add();
        destination = word.Documents.Open(sNewDoc, true, parseInt(word.Version, 
10) < vOffice2013);
    }
    catch (e)
    {
        WScript.Echo("Error opening " + sNewDoc);
        // Quit
        WScript.Quit(1);
    }
}

// If the Type property returns either wdOutlineView or wdMasterView and the 
Count property returns zero, the current document is an outline.
if (destination.ActiveWindow.View.Type === wdOutlineView || 
(destination.ActiveWindow.View.Type === wdMasterView || 
destination.ActiveWindow.View.Type === wdReadingView) && 
destination.Subdocuments.Count === 0)
{
    // Change the Type property of the current document to normal
    destination.ActiveWindow.View.Type = wdNormalView;
}

// Compare to the base document
if (parseInt(word.Version, 10) <= vOffice2000)
{
    // Compare for Office 2000 and earlier
    try
    {
        destination.Compare(sBaseDoc);
    }
    catch (e)
    {
        WScript.Echo("Error comparing " + sBaseDoc + " and " + sNewDoc);
        // Quit
        WScript.Quit(1);
    }
}
else
{
    // Compare for Office XP (2002) and later
    try
    {
        destination.Compare(sBaseDoc, "Comparison", wdCompareTargetNew, true, 
true);
    }
    catch (e)
    {
        WScript.Echo("Error comparing " + sBaseDoc + " and " + sNewDoc);
        // Close the first document and quit
        destination.Close(wdDoNotSaveChanges);
        WScript.Quit(1);
    }
}

// Show the comparison result
if (parseInt(word.Version, 10) < vOffice2007)
{
    word.ActiveDocument.Windows(1).Visible = 1;
}

// Mark the comparison document as saved to prevent the annoying
// "Save as" dialog from appearing.
word.ActiveDocument.Saved = 1;

// Close the first document
if (parseInt(word.Version, 10) >= vOffice2002)
{
    destination.Close(wdDoNotSaveChanges);
}

Reply via email to