2 ' TortoiseSVN Diff script for Open Office Calc files
4 ' Copyright (C) 2004-2009, 2012-2014 the TortoiseSVN team
5 ' This file is distributed under the same license as TortoiseSVN
13 ' Jonathan Ashley, 2007
16 dim objArgs
, num
, sBaseDoc
, sNewDoc
, objScript
18 Set objArgs
= WScript
.Arguments
21 MsgBox
"Usage: [CScript | WScript] compare.vbs base.doc new.doc", vbExclamation
, "Invalid arguments"
28 Set objScript
= CreateObject("Scripting.FileSystemObject")
29 If objScript
.FileExists(sBaseDoc
) = False Then
30 MsgBox
"File " + sBaseDoc
+" does not exist. Cannot compare the documents.", vbExclamation
, "File not found"
33 If objScript
.FileExists(sNewDoc
) = False Then
34 MsgBox
"File " + sNewDoc
+" does not exist. Cannot compare the documents.", vbExclamation
, "File not found"
38 Set objScript
= Nothing
41 'The service manager is always the starting point
42 'If there is no office running then an office is started
43 Set objServiceManager
= Wscript
.CreateObject("com.sun.star.ServiceManager")
44 If Err
.Number
<> 0 Then
45 Wscript
.Echo
"You must have OpenOffice installed to perform this operation."
50 'Create the DesktopSet
51 Set objDesktop
= objServiceManager
.createInstance("com.sun.star.frame.Desktop")
52 'Adjust the paths for OO
53 sBaseDoc
= Replace(sBaseDoc
, "\", "/")
54 sBaseDoc
= Replace(sBaseDoc
, ":", "|")
55 sBaseDoc
= Replace(sBaseDoc
, "%", "%25")
56 sBaseDoc
= Replace(sBaseDoc
, " ", "%20")
57 sBaseDoc
= "file:///"&sBaseDoc
58 sNewDoc
= Replace(sNewDoc
, "\", "/")
59 sNewDoc
= Replace(sNewDoc
, ":", "|")
60 sNewDoc
= Replace(sNewDoc
, "%", "%25")
61 sNewDoc
= Replace(sNewDoc
, " ", "%20")
62 sNewDoc
= "file:///"&sNewDoc
64 'Open the %base document
66 Set oPropertyValue(0) = objServiceManager
.Bridge_GetStruct("com.sun.star.beans.PropertyValue")
67 oPropertyValue(0).Name
= "ShowTrackedChanges"
68 oPropertyValue(0).Value
= true
69 Set objDocument
= objDesktop
.loadComponentFromURL(sNewDoc
, "_blank", 0, oPropertyValue
)
70 Set objDocument2
= objDesktop
.loadComponentFromURL(sBaseDoc
, "_blank", 0, oPropertyValue
)