• R/O
  • SSH
  • HTTPS

tortoisesvn: Commit


Commit MetaInfo

Revision4425 (tree)
Zeit2005-09-21 01:32:43
Autorstefankueng

Log Message

Replace the doc merge and diff vbscripts with jscripts which work better.
Patch from Davide Orlandi and Hans-Emil Skogh.

Ändern Zusammenfassung

Diff

--- trunk/contrib/other/diff-scripts/diff-doc.vbs (revision 4424)
+++ trunk/contrib/other/diff-scripts/diff-doc.vbs (nonexistent)
@@ -1,51 +0,0 @@
1-dim objArgs,num,sBaseDoc,sNewDoc,objScript,word,destination
2-
3-Set objArgs = WScript.Arguments
4-num = objArgs.Count
5-if num < 2 then
6- MsgBox "Usage: [CScript | WScript] compare.vbs base.doc new.doc", vbExclamation, "Invalid arguments"
7- WScript.Quit 1
8-end if
9-
10-sBaseDoc=objArgs(0)
11-sNewDoc=objArgs(1)
12-
13-Set objScript = CreateObject("Scripting.FileSystemObject")
14-If objScript.FileExists(sBaseDoc) = False Then
15- MsgBox "File " + sBaseDoc +" does not exist. Cannot compare the documents.", vbExclamation, "File not found"
16- Wscript.Quit 1
17-End If
18-If objScript.FileExists(sNewDoc) = False Then
19- MsgBox "File " + sNewDoc +" does not exist. Cannot compare the documents.", vbExclamation, "File not found"
20- Wscript.Quit 1
21-End If
22-
23-Set objScript = Nothing
24-
25-On Error Resume Next
26-set word = createobject("Word.Application")
27-If Err.Number <> 0 Then
28- Wscript.Echo "You must have Microsoft Word installed to perform this operation."
29- Wscript.Quit 1
30-End If
31-
32-On Error Goto 0
33-
34-word.visible=True
35-
36-' Open the new document
37-set destination = word.Documents.Open(sNewDoc)
38-
39-' Compare to the base document
40-destination.Compare(sBaseDoc)
41-
42-' Show the comparison result
43-word.ActiveDocument.Windows(1).Visible = 1
44-
45-' Mark the comparison document as saved to prevent the annoying
46-' "Save as" dialog from appearing.
47-word.ActiveDocument.Saved = 1
48-
49-' Close the first document
50-destination.Close
51-
Deleted: svn:eol-style
## -1 +0,0 ##
-native
\ No newline at end of property
--- trunk/contrib/other/diff-scripts/merge-doc.vbs (revision 4424)
+++ trunk/contrib/other/diff-scripts/merge-doc.vbs (nonexistent)
@@ -1,51 +0,0 @@
1-option explicit
2-
3-dim objArgs,num,sTheirDoc,sMyDoc,sBaseDoc,sMergedDoc,objScript,word,baseDoc
4-
5-Set objArgs = WScript.Arguments
6-num = objArgs.Count
7-if num < 4 then
8- MsgBox "Usage: [CScript | WScript] merge.vbs %merged %theirs %mine %base", vbExclamation, "Invalid arguments"
9- WScript.Quit 1
10-end if
11-
12-sMergedDoc=objArgs(0)
13-sTheirDoc=objArgs(1)
14-sMyDoc=objArgs(2)
15-sBaseDoc=objArgs(3)
16-
17-Set objScript = CreateObject("Scripting.FileSystemObject")
18-If objScript.FileExists(sTheirDoc) = False Then
19- MsgBox "File " + sTheirDoc +" does not exist. Cannot compare the documents.", vbExclamation, "File not found"
20- Wscript.Quit 1
21-End If
22-If objScript.FileExists(sMergedDoc) = False Then
23- MsgBox "File " + sMergedDoc +" does not exist. Cannot compare the documents.", vbExclamation, "File not found"
24- Wscript.Quit 1
25-End If
26-
27-Set objScript = Nothing
28-
29-On Error Resume Next
30-set word = createobject("Word.Application")
31-If Err.Number <> 0 Then
32- Wscript.Echo "You must have Microsoft Word installed to perform this operation."
33- Wscript.Quit 1
34-End If
35-
36-On Error Goto 0
37-
38-word.visible=True
39-
40-' Open the base document
41-set baseDoc = word.Documents.Open(sTheirDoc)
42-
43-' Merge into the "My" document
44-baseDoc.Merge(sMergedDoc)
45-
46-' Show the merge result
47-word.ActiveDocument.Windows(1).Visible = 1
48-
49-' Close the first document
50-baseDoc.Close
51-
Deleted: svn:eol-style
## -1 +0,0 ##
-native
\ No newline at end of property
--- trunk/contrib/other/diff-scripts/diff-doc.js (nonexistent)
+++ trunk/contrib/other/diff-scripts/diff-doc.js (revision 4425)
@@ -0,0 +1,57 @@
1+var objArgs,num,sBaseDoc,sNewDoc,objScript,word,destination;
2+
3+objArgs = WScript.Arguments;
4+num = objArgs.length;
5+if (num < 2)
6+{
7+ WScript.Echo("Usage: [CScript | WScript] diff-doc.js base.doc new.doc");
8+ WScript.Quit(1);
9+}
10+
11+sBaseDoc = objArgs(0);
12+sNewDoc = objArgs(1);
13+
14+objScript = new ActiveXObject("Scripting.FileSystemObject");
15+if ( ! objScript.FileExists(sBaseDoc))
16+{
17+ WScript.Echo("File " + sBaseDoc + " does not exist. Cannot compare the documents.");
18+ Wscript.Quit(1);
19+}
20+if ( ! objScript.FileExists(sNewDoc))
21+{
22+ WScript.Echo("File " + sNewDoc +" does not exist. Cannot compare the documents.");
23+ Wscript.Quit(1);
24+}
25+
26+objScript = null;
27+
28+try
29+{
30+ word = WScript.CreateObject("Word.Application");
31+}
32+catch(e)
33+{
34+ Wscript.Echo("You must have Microsoft Word installed to perform this operation.");
35+ Wscript.Quit(1);
36+}
37+
38+word.visible = true;
39+
40+// Open the new document
41+destination = word.Documents.Open(sNewDoc);
42+
43+// Compare to the base document
44+destination.Compare(sBaseDoc);
45+
46+// Show the comparison result
47+word.ActiveDocument.Windows(1).Visible = 1;
48+
49+// Mark the comparison document as saved to prevent the annoying
50+// "Save as" dialog from appearing.
51+word.ActiveDocument.Saved = 1;
52+
53+// Close the first document
54+if (Number(word.Version) >= 10)
55+{
56+ destination.Close();
57+}
Added: svn:eol-style
## -0,0 +1 ##
+native
\ No newline at end of property
--- trunk/contrib/other/diff-scripts/merge-doc.js (nonexistent)
+++ trunk/contrib/other/diff-scripts/merge-doc.js (revision 4425)
@@ -0,0 +1,62 @@
1+var objArgs,num,sTheirDoc,sMyDoc,sBaseDoc,sMergedDoc,objScript,word,baseDoc,WSHShell;
2+
3+objArgs = WScript.Arguments;
4+num = objArgs.length;
5+if (num < 4)
6+{
7+ WScript.Echo("Usage: [CScript | WScript] merge-doc.js merged.doc theirs.doc mine.doc base.doc");
8+ WScript.Quit(1);
9+}
10+
11+sMergedDoc=objArgs(0);
12+sTheirDoc=objArgs(1);
13+sMyDoc=objArgs(2);
14+sBaseDoc=objArgs(3);
15+
16+objScript = new ActiveXObject("Scripting.FileSystemObject")
17+if ( ! objScript.FileExists(sTheirDoc))
18+{
19+ WScript.Echo("File " + sTheirDoc +" does not exist. Cannot compare the documents.", vbExclamation, "File not found");
20+ Wscript.Quit(1);
21+}
22+if ( ! objScript.FileExists(sMergedDoc))
23+{
24+ WScript.Echo("File " + sMergedDoc +" does not exist. Cannot compare the documents.", vbExclamation, "File not found");
25+ Wscript.Quit(1);
26+}
27+
28+objScript = null
29+
30+try
31+{
32+ word = WScript.CreateObject("Word.Application");
33+}
34+catch(e)
35+{
36+ Wscript.Echo("You must have Microsoft Word installed to perform this operation.");
37+ Wscript.Quit(1);
38+}
39+
40+word.visible = true
41+
42+// Open the base document
43+baseDoc = word.Documents.Open(sTheirDoc);
44+
45+// Merge into the "My" document
46+baseDoc.Merge(sMergedDoc);
47+
48+// Show the merge result
49+word.ActiveDocument.Windows(1).Visible = 1;
50+
51+// Close the first document
52+if (Number(word.Version) >= 10)
53+{
54+ baseDoc.Close();
55+}
56+
57+// Show usage hint message
58+WSHShell = WScript.CreateObject("WScript.Shell");
59+if(WSHShell.Popup("You have to accept or reject the changes before\nsaving the document to prevent future problems.\n\nWould you like to see a help page on how to do this?", 0, "TSVN Word Merge", 4 + 64) == 6)
60+{
61+ WSHShell.Run("http://office.microsoft.com/en-us/assistance/HP030823691033.aspx");
62+}
Added: svn:eol-style
## -0,0 +1 ##
+native
\ No newline at end of property
--- trunk/www/contributors.html (revision 4424)
+++ trunk/www/contributors.html (revision 4425)
@@ -92,6 +92,8 @@
9292 <li>Norbert Unterberg</li>
9393 <li>Valik</li>
9494 <li>George Wieggers</li>
95+<li>Davide Orlandi</li>
96+<li>Hans-Emil Skogh</li>
9597 </ul>
9698 </div>
9799
Show on old repository browser