Changeset b4d8fcb85b1d…
Parent 16f45dd79cb7…
by
Changes to 10 files · Browse files at b4d8fcb85b1d Showing diff from parent 16f45dd79cb7 Diff from another changeset...
|
@@ -0,0 +1,13 @@ + This folder contains scripts which can be used to start other programs
+to diff non-text files.
+
+The scripts are named after the file extension they're able to diff.
+E.g. the script to diff word files is called 'diff-doc.vbs', the script
+to merge three word files is called 'merge-doc.vbs'.
+
+The scripts must be implemented so that they take the following parameters:
+diff-ext %base %mine
+merge-ext %merged %theirs %mine %base
+
+The scripts can then decide themselves if they need all the params or if
+they have to add additional params to the application they call.
|
|
@@ -0,0 +1,7 @@ + These files were downloaded from:
+
+http://tortoisesvn.tigris.org/svn/tortoisesvn/trunk/contrib/diff-scripts/
+
+username: guest, no password
+
+On Christmas day, 2009.
\ No newline at end of file |
|
|
@@ -0,0 +1,194 @@ + // extensions: doc;docx;docm
+//
+// TortoiseSVN Diff script for Word Doc files
+//
+// Copyright (C) 2004-2008 the TortoiseSVN team
+// This file is distributed under the same license as TortoiseSVN
+//
+// Last commit by:
+// $Author$
+// $Date$
+// $Rev$
+//
+// Authors:
+// 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;
+// 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;
+
+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);
+}
+
+try
+{
+ word = WScript.CreateObject("Word.Application");
+}
+catch(e)
+{
+ // before giving up, try with OpenOffice
+ try
+ {
+ var OO;
+ 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 = 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="file:///" + sBaseDoc;
+ sBaseDoc=objUriTranslator.translateToInternal(sBaseDoc);
+ sNewDoc = sNewDoc.replace(/\\/g, "/");
+ sNewDoc = sNewDoc.replace(/:/g, "|");
+ sNewDoc = sNewDoc.replace(/ /g, "%20");
+ sNewDoc="file:///" + sNewDoc;
+ sNewDoc=objUriTranslator.translateToInternal(sNewDoc);
+
+ //Open the %base document
+ var oPropertyValue = new Array();
+ oPropertyValue[0] = OO.Bridge_GetStruct("com.sun.star.beans.PropertyValue");
+ oPropertyValue[0].Name = "ShowTrackedChanges";
+ oPropertyValue[0].Value = true;
+ var objDocument=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) >= vOffice2007)
+{
+ sTempDoc = sNewDoc;
+ sNewDoc = sBaseDoc;
+ sBaseDoc = sTempDoc;
+}
+
+objScript = null;
+
+word.visible = true;
+
+// Open the new document
+try
+{
+ destination = word.Documents.Open(sNewDoc, true, true);
+}
+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.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) <= 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) < 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) >= vOffice2002)
+{
+ destination.Close(wdDoNotSaveChanges);
+}
|
|
@@ -0,0 +1,67 @@ + '
+' TortoiseSVN Diff script for Mathematica notebooks
+'
+' Last commit by:
+' $Author$
+' $Date$
+' $Rev$
+'
+' Authors:
+' Szabolcs Horvát, 2008
+' Chris Rodgers http://rodgers.org.uk/, 2008
+' (Based on diff-xlsx.vbs)
+'
+
+dim objArgs, objScript, objDiffNotebook
+
+Set objArgs = WScript.Arguments
+num = objArgs.Count
+if num < 2 then
+ MsgBox "Usage: [CScript | WScript] compare.vbs base.nb new.nb", vbExclamation, "Invalid arguments"
+ WScript.Quit 1
+end if
+
+sBaseDoc = objArgs(0)
+sNewDoc = objArgs(1)
+
+Set objScript = CreateObject("Scripting.FileSystemObject")
+
+If objScript.FileExists(sBaseDoc) = False Then
+ MsgBox "File " + sBaseDoc +" does not exist. Cannot compare the notebooks.", vbExclamation, "File not found"
+ Wscript.Quit 1
+Else
+ sBaseDoc = objScript.GetAbsolutePathName(sBaseDoc)
+End If
+
+If objScript.FileExists(sNewDoc) = False Then
+ MsgBox "File " + sNewDoc +" does not exist. Cannot compare the notebooks.", vbExclamation, "File not found"
+ Wscript.Quit 1
+Else
+ sNewDoc = objScript.GetAbsolutePathName(sNewDoc)
+End If
+
+On Error Resume Next
+Dim tfolder, tname, tfile
+Const TemporaryFolder = 2
+
+Set tfolder = objScript.GetSpecialFolder(TemporaryFolder)
+
+tname = objScript.GetTempName + ".nb"
+Set objDiffNotebook = tfolder.CreateTextFile(tname)
+
+'Output a Mathematica notebook that will do the diff for us
+objDiffNotebook.WriteLine "Notebook[{" + vbCrLf + _
+"Cell[BoxData[ButtonBox[""\<\""Compare Notebooks\""\>""," + vbCrLf + _
+"ButtonFrame->""DialogBox"", Active->True, ButtonEvaluator->Automatic," + vbCrLf + _
+"ButtonFunction:>(Needs[""AuthorTools`""];" + vbCrLf + _
+"NotebookPut[Symbol[""NotebookDiff""][" + vbCrLf + _
+"""" + Replace(sBaseDoc,"\","\\") + """," + vbCrLf + _
+"""" + Replace(sNewDoc,"\","\\") + """" + vbCrLf + _
+"]])]], NotebookDefault]" + vbCrLf + _
+"}, Saveable->False, Editable->False, WindowToolbars->{}, WindowFrame->ModelessDialog, WindowElements->{}, WindowFrameElements->CloseBox, WindowTitle->""Diff"", ShowCellBracket->False, WindowSize->{Fit,Fit}]"
+
+
+objDiffNotebook.Close
+
+Set objShell = CreateObject("WScript.Shell")
+objShell.Run tfolder + "\" + tname
|
|
@@ -0,0 +1,100 @@ + ' extensions: odt;ods
+'
+' TortoiseSVN Diff script for Open Office Text files
+'
+' Copyright (C) 2004-2009 the TortoiseSVN team
+' This file is distributed under the same license as TortoiseSVN
+'
+' Last commit by:
+' $Author$
+' $Date$
+' $Rev$
+'
+' Authors:
+' Jonathan Ashley, 2007
+' Stefan Küng, 2006, 2009
+'
+dim objArgs,num,sBaseDoc,sNewDoc,objScript,word,destination
+
+Set objArgs = WScript.Arguments
+num = objArgs.Count
+if num < 2 then
+ MsgBox "Usage: [CScript | WScript] diff-odt.vbs base.odt new.odt", vbExclamation, "Invalid arguments"
+ WScript.Quit 1
+end if
+
+sBaseDoc=objArgs(0)
+sNewDoc=objArgs(1)
+
+Set objScript = CreateObject("Scripting.FileSystemObject")
+If objScript.FileExists(sBaseDoc) = False Then
+ MsgBox "File " + sBaseDoc +" does not exist. Cannot compare the documents.", vbExclamation, "File not found"
+ Wscript.Quit 1
+End If
+If objScript.FileExists(sNewDoc) = False Then
+ MsgBox "File " + sNewDoc +" does not exist. Cannot compare the documents.", vbExclamation, "File not found"
+ Wscript.Quit 1
+End If
+'remove the file write protection
+objScript.GetFile(sBaseDoc).Attributes = objScript.GetFile(sBaseDoc).Attributes And Not 1
+objScript.GetFile(sNewDoc).Attributes = objScript.GetFile(sNewDoc).Attributes And Not 1
+
+Set objScript = Nothing
+
+On Error Resume Next
+'The service manager is always the starting point
+'If there is no office running then an office is started
+Set objServiceManager= Wscript.CreateObject("com.sun.star.ServiceManager")
+If Err.Number <> 0 Then
+ Wscript.Echo "You must have OpenOffice installed to perform this operation."
+ Wscript.Quit 1
+End If
+
+On Error Goto 0
+
+'Because this is a diff, TortoiseSVN marks the files as read-only.
+'However, OpenOffice will not compare any file with that flag set.
+'Make sure we un-set that flag.
+Set objFSO = CreateObject("Scripting.FileSystemObject")
+Set objFile = objFSO.GetFile(sNewDoc)
+If (objFile.Attributes AND 1)=1 Then
+ objFile.Attributes = objFile.Attributes XOR 1
+End If
+
+'Create the DesktopSet
+Set objDesktop = objServiceManager.createInstance("com.sun.star.frame.Desktop")
+Set objUriTranslator = objServiceManager.createInstance("com.sun.star.uri.ExternalUriReferenceTranslator")
+'Adjust the paths for OO
+sBaseDoc=Replace(sBaseDoc, "\", "/")
+sBaseDoc=Replace(sBaseDoc, ":", "|")
+sBaseDoc=Replace(sBaseDoc, "%", "%25")
+sBaseDoc=Replace(sBaseDoc, " ", "%20")
+sBaseDoc="file:///"&sBaseDoc
+sBaseDoc=objUriTranslator.translateToInternal(sBaseDoc)
+sNewDoc=Replace(sNewDoc, "\", "/")
+sNewDoc=Replace(sNewDoc, ":", "|")
+sNewDoc=Replace(sNewDoc, "%", "%25")
+sNewDoc=Replace(sNewDoc, " ", "%20")
+sNewDoc="file:///"&sNewDoc
+sNewDoc=objUriTranslator.translateToInternal(sNewDoc)
+
+'Open the %base document
+Dim oPropertyValue(0)
+Set oPropertyValue(0) = objServiceManager.Bridge_GetStruct("com.sun.star.beans.PropertyValue")
+oPropertyValue(0).Name = "ShowTrackedChanges"
+oPropertyValue(0).Value = true
+Set objDocument=objDesktop.loadComponentFromURL(sNewDoc,"_blank", 0, oPropertyValue)
+
+'Set the frame
+Set Frame = objDesktop.getCurrentFrame
+
+Set dispatcher=objServiceManager.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
+
+
+
|
|
@@ -0,0 +1,99 @@ + // extensions: ppt;pptx;pptm
+//
+// TortoiseSVN Diff script for Powerpoint files
+//
+// Copyright (C) 2004-2009 the TortoiseSVN team
+// This file is distributed under the same license as TortoiseSVN
+//
+// Last commit by:
+// $Author$
+// $Date$
+// $Rev$
+//
+// Authors:
+// Arne Moor, 2006
+//
+
+/*
+This script starts PowerPoint and compares the two given presentations.
+To better see the changes and get the highlighting feature of PowerPoint
+click on "Apply all changes to the presentation" on the reviewing toolbar.
+*/
+
+function PptAppMajorVersion(PowerPoint)
+{
+ var pptVersion;
+ try
+ {
+ pptVersion = PowerPoint.Version.toString();
+ if (pptVersion.indexOf(".") > 0)
+ {
+ pptVersion = pptVersion.substr(0, pptVersion.indexOf("."));
+ }
+ if (pptVersion == "")
+ return 0;
+ else
+ return parseInt(pptVersion);
+ }
+ catch(e)
+ {
+ return 0;
+ }
+}
+
+var objArgs,num,sBasePpt,sNewPpt,objScript,powerpoint,source;
+
+objArgs = WScript.Arguments;
+num = objArgs.length;
+if (num < 2)
+{
+ WScript.Echo("Usage: [CScript | WScript] diff-ppt.js base.ppt new.ppt");
+ WScript.Quit(1);
+}
+
+sBasePpt = objArgs(0);
+sNewPpt = objArgs(1);
+
+objScript = new ActiveXObject("Scripting.FileSystemObject");
+if ( ! objScript.FileExists(sBasePpt))
+{
+ WScript.Echo("File " + sBasePpt + " does not exist. Cannot compare the presentations.");
+ WScript.Quit(1);
+}
+if ( ! objScript.FileExists(sNewPpt))
+{
+ WScript.Echo("File " + sNewPpt +" does not exist. Cannot compare the presentations.");
+ WScript.Quit(1);
+}
+
+objScript = null;
+
+try
+{
+ powerpoint = WScript.CreateObject("Powerpoint.Application");
+}
+catch(e)
+{
+ WScript.Echo("You must have Microsoft Powerpoint installed to perform this operation.");
+ WScript.Quit(1);
+}
+
+if (PptAppMajorVersion(powerpoint) >= 12)
+{
+ WScript.Echo("Microsoft Powerpoint 2007 doesn't provide the DIFF features any more. Sorry!\r\nYou can try diffing with OpenOffice...");
+ WScript.Quit(1);
+}
+else
+{
+ powerpoint.visible = true;
+
+ // Open the original (base) document
+ source = powerpoint.Presentations.Open(sBasePpt);
+
+ // Merge the new document, to show the changes
+ source.Merge(sNewPpt);
+
+ // Mark the comparison presentation as saved to prevent the annoying
+ // "Save as" dialog from appearing.
+ powerpoint.ActivePresentation.Saved = 1;
+}
\ No newline at end of file |
|
@@ -0,0 +1,71 @@ + '
+' TortoiseSVN Diff script for Open Office Calc files
+'
+' Copyright (C) 2004-2008 the TortoiseSVN team
+' This file is distributed under the same license as TortoiseSVN
+'
+' Last commit by:
+' $Author$
+' $Date$
+' $Rev$
+'
+' Authors:
+' Jonathan Ashley, 2007
+' Stefan Küng, 2006
+'
+dim objArgs,num,sBaseDoc,sNewDoc,objScript,word,destination
+
+Set objArgs = WScript.Arguments
+num = objArgs.Count
+if num < 2 then
+ MsgBox "Usage: [CScript | WScript] compare.vbs base.doc new.doc", vbExclamation, "Invalid arguments"
+ WScript.Quit 1
+end if
+
+sBaseDoc=objArgs(0)
+sNewDoc=objArgs(1)
+
+Set objScript = CreateObject("Scripting.FileSystemObject")
+If objScript.FileExists(sBaseDoc) = False Then
+ MsgBox "File " + sBaseDoc +" does not exist. Cannot compare the documents.", vbExclamation, "File not found"
+ Wscript.Quit 1
+End If
+If objScript.FileExists(sNewDoc) = False Then
+ MsgBox "File " + sNewDoc +" does not exist. Cannot compare the documents.", vbExclamation, "File not found"
+ Wscript.Quit 1
+End If
+
+Set objScript = Nothing
+
+On Error Resume Next
+'The service manager is always the starting point
+'If there is no office running then an office is started
+Set objServiceManager= Wscript.CreateObject("com.sun.star.ServiceManager")
+If Err.Number <> 0 Then
+ Wscript.Echo "You must have OpenOffice installed to perform this operation."
+ Wscript.Quit 1
+End If
+
+On Error Goto 0
+'Create the DesktopSet
+Set objDesktop = objServiceManager.createInstance("com.sun.star.frame.Desktop")
+'Adjust the paths for OO
+sBaseDoc=Replace(sBaseDoc, "\", "/")
+sBaseDoc=Replace(sBaseDoc, ":", "|")
+sBaseDoc=Replace(sBaseDoc, "%", "%25")
+sBaseDoc=Replace(sBaseDoc, " ", "%20")
+sBaseDoc="file:///"&sBaseDoc
+sNewDoc=Replace(sNewDoc, "\", "/")
+sNewDoc=Replace(sNewDoc, ":", "|")
+sNewDoc=Replace(sNewDoc, "%", "%25")
+sNewDoc=Replace(sNewDoc, " ", "%20")
+sNewDoc="file:///"&sNewDoc
+
+'Open the %base document
+Dim oPropertyValue(0)
+Set oPropertyValue(0) = objServiceManager.Bridge_GetStruct("com.sun.star.beans.PropertyValue")
+oPropertyValue(0).Name = "ShowTrackedChanges"
+oPropertyValue(0).Value = true
+Set objDocument=objDesktop.loadComponentFromURL(sNewDoc,"_blank", 0, oPropertyValue)
+Set objDocument2=objDesktop.loadComponentFromURL(sBaseDoc,"_blank",0, oPropertyValue)
+
|
|
@@ -0,0 +1,89 @@ + ' extensions: xls;xlsx;xlsm;xlsb;xlam
+'
+' TortoiseSVN Diff script for Excel files
+'
+' Copyright (C) 2004-2008 the TortoiseSVN team
+' This file is distributed under the same license as TortoiseSVN
+'
+' Last commit by:
+' $Author$
+' $Date$
+' $Rev$
+'
+' Authors:
+' Michael Joras <michael@joras.net>, 2008
+' Suraj Barkale, 2006
+'
+
+dim objExcelApp, objArgs, objScript, objBaseDoc, objNewDoc, objWorkSheet, i
+
+Set objArgs = WScript.Arguments
+num = objArgs.Count
+if num < 2 then
+ MsgBox "Usage: [CScript | WScript] compare.vbs base.doc new.doc", vbExclamation, "Invalid arguments"
+ WScript.Quit 1
+end if
+
+sBaseDoc = objArgs(0)
+sNewDoc = objArgs(1)
+
+Set objScript = CreateObject("Scripting.FileSystemObject")
+If objScript.FileExists(sBaseDoc) = False Then
+ MsgBox "File " + sBaseDoc +" does not exist. Cannot compare the documents.", vbExclamation, "File not found"
+ Wscript.Quit 1
+End If
+If objScript.FileExists(sNewDoc) = False Then
+ MsgBox "File " + sNewDoc +" does not exist. Cannot compare the documents.", vbExclamation, "File not found"
+ Wscript.Quit 1
+End If
+
+Set objScript = Nothing
+
+On Error Resume Next
+Set objExcelApp = Wscript.CreateObject("Excel.Application")
+If Err.Number <> 0 Then
+ Wscript.Echo "You must have Excel installed to perform this operation."
+ Wscript.Quit 1
+End If
+
+'Open base excel sheet
+objExcelApp.Workbooks.Open sBaseDoc
+'Open new excel sheet
+objExcelApp.Workbooks.Open sNewDoc
+'Show Excel window
+objExcelApp.Visible = True
+'Create a compare side by side view
+objExcelApp.Windows.CompareSideBySideWith(objExcelApp.Windows(2).Caption)
+If Err.Number <> 0 Then
+ objExcelApp.Application.WindowState = xlMaximized
+ objExcelApp.Windows.Arrange(-4128)
+End If
+
+'Mark differences in sNewDoc red
+i = 1
+
+For Each objWorkSheet In objExcelApp.Workbooks(2).Worksheets
+
+ objworksheet.Cells.FormatConditions.Delete
+
+ objExcelApp.Workbooks(1).Sheets(i).Copy ,objExcelApp.Workbooks(2).Sheets(objExcelApp.Workbooks(2).Sheets.Count)
+
+ objExcelApp.Workbooks(2).Sheets(objExcelApp.Workbooks(2).Sheets.Count).Name = "Dummy_for_Comparison" & i
+
+ objworksheet.Activate
+ 'To create a local formula the cell A1 is used
+ original_content = objworksheet.Cells(1,1).Formula
+ String sFormula
+ 'objworksheet.Cells(1,1).Formula = "=INDIRECT(""" & objExcelApp.Workbooks(2).Sheets(i).name & " (2)"& "!""&ADDRESS(ROW(),COLUMN()))"
+ objworksheet.Cells(1,1).Formula = "=INDIRECT(""Dummy_for_Comparison" & i & "!""&ADDRESS(ROW(),COLUMN()))"
+ sFormula = objworksheet.Cells(1,1).FormulaLocal
+
+ objworksheet.Cells(1,1).Formula = original_content
+ 'with the local formula the conditional formatting is used to mark the cells that are different
+ const xlCellValue = 1
+ const xlNotEqual = 4
+ objworksheet.Cells.FormatConditions.Add xlCellValue, xlNotEqual, sFormula
+ objworksheet.Cells.FormatConditions(1).Interior.ColorIndex = 3
+
+ i = i + 1
+next
|
|
@@ -0,0 +1,101 @@ + // extensions: doc;docx;docm
+//
+// TortoiseSVN Merge script for Word Doc files
+//
+// Copyright (C) 2004-2008 the TortoiseSVN team
+// This file is distributed under the same license as TortoiseSVN
+//
+// Last commit by:
+// $Author$
+// $Date$
+// $Rev$
+//
+// Authors:
+// Dan Sheridan, 2008
+// Davide Orlandi and Hans-Emil Skogh, 2005
+//
+
+var objArgs,num,sTheirDoc,sMyDoc,sBaseDoc,sMergedDoc,objScript,word,baseDoc,WSHShell;
+
+// Microsoft Office versions for Microsoft Windows OS
+var vOffice2000 = 9;
+var vOffice2002 = 10;
+var vOffice2003 = 11;
+var vOffice2007 = 12;
+// WdCompareTarget
+var wdCompareTargetSelected = 0;
+var wdCompareTargetCurrent = 1;
+var wdCompareTargetNew = 2;
+
+objArgs = WScript.Arguments;
+num = objArgs.length;
+if (num < 4)
+{
+ WScript.Echo("Usage: [CScript | WScript] merge-doc.js merged.doc theirs.doc mine.doc base.doc");
+ WScript.Quit(1);
+}
+
+sMergedDoc=objArgs(0);
+sTheirDoc=objArgs(1);
+sMyDoc=objArgs(2);
+sBaseDoc=objArgs(3);
+
+objScript = new ActiveXObject("Scripting.FileSystemObject")
+if ( ! objScript.FileExists(sTheirDoc))
+{
+ WScript.Echo("File " + sTheirDoc +" does not exist. Cannot compare the documents.", vbExclamation, "File not found");
+ WScript.Quit(1);
+}
+if ( ! objScript.FileExists(sMergedDoc))
+{
+ WScript.Echo("File " + sMergedDoc +" does not exist. Cannot compare the documents.", vbExclamation, "File not found");
+ WScript.Quit(1);
+}
+
+objScript = null
+
+try
+{
+ word = WScript.CreateObject("Word.Application");
+}
+catch(e)
+{
+ WScript.Echo("You must have Microsoft Word installed to perform this operation.");
+ WScript.Quit(1);
+}
+
+word.visible = true
+
+// Open the base document
+baseDoc = word.Documents.Open(sTheirDoc);
+
+// Merge into the "My" document
+if (parseInt(word.Version) < vOffice2000)
+{
+ baseDoc.Compare(sMergedDoc);
+}
+else if (parseInt(word.Version) < vOffice2007)
+{
+ baseDoc.Compare(sMergedDoc, "Comparison", wdCompareTargetNew, true, true);
+} else {
+ baseDoc.Merge(sMergedDoc);
+}
+
+// Show the merge result
+if (parseInt(word.Version) < 12)
+{
+ word.ActiveDocument.Windows(1).Visible = 1;
+}
+
+// Close the first document
+if (parseInt(word.Version) >= 10)
+{
+ baseDoc.Close();
+}
+
+// Show usage hint message
+WSHShell = WScript.CreateObject("WScript.Shell");
+if(WSHShell.Popup("You have to accept or reject the changes before\nsaving the document to prevent future problems.\n\nWould you like to see a help page on how to do this?", 0, "TSVN Word Merge", 4 + 64) == 6)
+{
+ WSHShell.Run("http://office.microsoft.com/en-us/assistance/HP030823691033.aspx");
+}
|
|
@@ -0,0 +1,87 @@ + ' extensions: ods;odt;sxw
+'
+' TortoiseSVN Merge script for Open Office Calc files
+'
+' Copyright (C) 2004-2009 the TortoiseSVN team
+' This file is distributed under the same license as TortoiseSVN
+'
+' Last commit by:
+' $Author$
+' $Date$
+' $Rev$
+'
+' Authors:
+' Jonathan Ashley, 2007
+' Stefan Küng, 2006, 2009
+'
+dim objArgs,num,sBaseDoc,sMergedDoc,sTheirDoc,sMyDoc,objScript,word,destination
+
+Set objArgs = WScript.Arguments
+num = objArgs.Count
+if num < 4 then
+ MsgBox "Usage: [CScript | WScript] merge-ods.vbs %merged %theirs %mine %base", vbExclamation, "Invalid arguments"
+ WScript.Quit 1
+end if
+
+sMergedDoc=objArgs(0)
+sTheirDoc=objArgs(1)
+sMyDoc=objArgs(2)
+sBaseDoc=objArgs(3)
+
+Set objScript = CreateObject("Scripting.FileSystemObject")
+If objScript.FileExists(sMyDoc) = False Then
+ MsgBox "File " + sMyDoc +" does not exist. Cannot compare the documents.", vbExclamation, "File not found"
+ Wscript.Quit 1
+End If
+If objScript.FileExists(sTheirDoc) = False Then
+ MsgBox "File " + sTheirDoc +" does not exist. Cannot compare the documents.", vbExclamation, "File not found"
+ Wscript.Quit 1
+End If
+'remove the file write protection
+objScript.GetFile(sMyDoc).Attributes = objScript.GetFile(sMyDoc).Attributes And Not 1
+objScript.GetFile(sTheirDoc).Attributes = objScript.GetFile(sTheirDoc).Attributes And Not 1
+
+Set objScript = Nothing
+
+On Error Resume Next
+'The service manager is always the starting point
+'If there is no office running then an office is started
+Set objServiceManager= Wscript.CreateObject("com.sun.star.ServiceManager")
+If Err.Number <> 0 Then
+ Wscript.Echo "You must have OpenOffice installed to perform this operation."
+ Wscript.Quit 1
+End If
+
+On Error Goto 0
+'Create the DesktopSet
+Set objDesktop = objServiceManager.createInstance("com.sun.star.frame.Desktop")
+'Adjust the paths for OO
+sMyDoc=Replace(sMyDoc, "\", "/")
+sMyDoc=Replace(sMyDoc, ":", "|")
+sMyDoc=Replace(sMyDoc, "%", "%25")
+sMyDoc=Replace(sMyDoc, " ", "%20")
+sMyDoc="file:///"&sMyDoc
+sTheirDoc=Replace(sTheirDoc, "\", "/")
+sTheirDoc=Replace(sTheirDoc, ":", "|")
+sTheirDoc=Replace(sTheirDoc, "%", "%25")
+sTheirDoc=Replace(sTheirDoc, " ", "%20")
+sTheirDoc="file:///"&sTheirDoc
+
+'Open the %mine document
+Dim oPropertyValue(0)
+Set oPropertyValue(0) = objServiceManager.Bridge_GetStruct("com.sun.star.beans.PropertyValue")
+oPropertyValue(0).Name = "ShowTrackedChanges"
+oPropertyValue(0).Value = true
+Set objDocument=objDesktop.loadComponentFromURL(sMyDoc,"_blank", 0, oPropertyValue)
+
+'Set the frame
+Set Frame = objDesktop.getCurrentFrame
+
+Set dispatcher=objServiceManager.CreateInstance("com.sun.star.frame.DispatchHelper")
+
+'Execute the comparison
+Dispatcher.executeDispatch Frame, ".uno:ShowTrackedChanges", "", 0, oPropertyValue
+oPropertyValue(0).Name = "URL"
+oPropertyValue(0).Value = sTheirDoc
+Dispatcher.executeDispatch Frame, ".uno:CompareDocuments", "", 0, oPropertyValue
+
|
Loading...