Kiln » TortoiseHg » WinBuild Read More
Clone URL:  
diff-sxw.vbs
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
' ' 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)