1 // extensions: ppt;pptx;pptm
\r
3 // TortoiseSVN Diff script for Powerpoint files
\r
5 // Copyright (C) 2004-2009, 2019 the TortoiseSVN team
\r
6 // This file is distributed under the same license as TortoiseSVN
\r
18 This script starts PowerPoint and compares the two given presentations.
\r
19 To better see the changes and get the highlighting feature of PowerPoint
\r
20 click on "Apply all changes to the presentation" on the reviewing toolbar.
\r
23 function PptAppMajorVersion(PowerPoint)
\r
28 pptVersion = PowerPoint.Version.toString();
\r
29 if (pptVersion.indexOf(".") > 0)
\r
31 pptVersion = pptVersion.substr(0, pptVersion.indexOf("."));
\r
33 if (pptVersion === "")
\r
39 return parseInt(pptVersion, 10);
\r
48 var objArgs, num, sBasePpt, sNewPpt, objScript, powerpoint, source;
\r
50 objArgs = WScript.Arguments;
\r
51 num = objArgs.length;
\r
54 WScript.Echo("Usage: [CScript | WScript] diff-ppt.js base.ppt new.ppt");
\r
58 sBasePpt = objArgs(0);
\r
59 sNewPpt = objArgs(1);
\r
61 objScript = new ActiveXObject("Scripting.FileSystemObject");
\r
63 if (!objScript.FileExists(sBasePpt))
\r
65 WScript.Echo("File " + sBasePpt + " does not exist. Cannot compare the presentations.");
\r
69 if (!objScript.FileExists(sNewPpt))
\r
71 WScript.Echo("File " + sNewPpt + " does not exist. Cannot compare the presentations.");
\r
79 powerpoint = WScript.CreateObject("Powerpoint.Application");
\r
81 powerpoint.AutomationSecurity = 3; //msoAutomationSecurityForceDisable
\r
85 WScript.Echo("You must have Microsoft Powerpoint installed to perform this operation.");
\r
89 if (PptAppMajorVersion(powerpoint) === 12)
\r
91 WScript.Echo("Microsoft Powerpoint 2007 doesn't provide the DIFF features any more. Sorry!");
\r
96 powerpoint.visible = true;
\r
98 // Open the original (base) document
\r
99 source = powerpoint.Presentations.Open(sBasePpt);
\r
101 // Merge the new document, to show the changes
\r
102 source.Merge(sNewPpt);
\r
104 // Mark the comparison presentation as saved to prevent the annoying
\r
105 // "Save as" dialog from appearing.
\r
106 powerpoint.ActivePresentation.Saved = 1;
\r