Kiln » TortoiseHg » WinBuild Read More
Clone URL:  
diff-ppt.js
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
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
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; }