Update spell checker dictionaries
[TortoiseGit.git] / contrib / diff-scripts / diff-sxw.vbs
blobc7dbd11981824196fbcba5e117c9d20519b8a5b8
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
7 ' Last commit by:
8 ' $Author$
9 ' $Date$
10 ' $Rev$
12 ' Authors:
13 ' Jonathan Ashley, 2007
14 ' Stefan Küng, 2006
16 dim objArgs, num, sBaseDoc, sNewDoc, objScript
18 Set objArgs = WScript.Arguments
19 num = objArgs.Count
20 if num < 2 then
21 MsgBox "Usage: [CScript | WScript] compare.vbs base.doc new.doc", vbExclamation, "Invalid arguments"
22 WScript.Quit 1
23 end if
25 sBaseDoc = objArgs(0)
26 sNewDoc = objArgs(1)
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"
31 Wscript.Quit 1
32 End If
33 If objScript.FileExists(sNewDoc) = False Then
34 MsgBox "File " + sNewDoc +" does not exist. Cannot compare the documents.", vbExclamation, "File not found"
35 Wscript.Quit 1
36 End If
38 Set objScript = Nothing
40 On Error Resume Next
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."
46 Wscript.Quit 1
47 End If
49 On Error Goto 0
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
65 Dim oPropertyValue(0)
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)