Index: /main/trunk/binaries/windows/bin/docx2html.vbs
===================================================================
--- /main/trunk/binaries/windows/bin/docx2html.vbs	(revision 24164)
+++ /main/trunk/binaries/windows/bin/docx2html.vbs	(revision 24164)
@@ -0,0 +1,98 @@
+Option Explicit
+
+'args = WScript.Arguments.Count
+'If args < 2 then
+'  WScript.Echo usage: args.vbs argument [input docx path] [output html path]
+'  WScript.Quit
+'end If
+'WScript.Echo WScript.Arguments.Item(0)
+'WScript.Echo WScript.Arguments.Item(1)
+
+Doc2HTML WScript.Arguments.Item(0),WScript.Arguments.Item(1)
+' In terminal, run as: > docx2html.vbs C:\fullpath\to\input.docx C:\fullpath\to\output.html
+
+
+' http://www.robvanderwoude.com/vbstech_automation_word.php
+' http://www.nilpo.com/2008/06/windows-scripting/reading-word-documents-in-wsh/
+
+Sub Doc2HTML( inFile, outHTML )
+' This subroutine opens a Word document,
+' then saves it as HTML, and closes Word.
+' If the HTML file exists, it is overwritten.
+' If Word was already active, the subroutine
+' will leave the other document(s) alone and
+' close only its "own" document.
+'
+' Written by Rob van der Woude
+' http://www.robvanderwoude.com
+    ' Standard housekeeping
+    Dim objDoc, objFile, objFSO, objWord, strFile
+
+    Const wdFormatDocument                    =  0
+    Const wdFormatDocument97                  =  0
+    Const wdFormatDocumentDefault             = 16
+    Const wdFormatDOSText                     =  4
+    Const wdFormatDOSTextLineBreaks           =  5
+    Const wdFormatEncodedText                 =  7
+    Const wdFormatFilteredHTML                = 10
+    Const wdFormatFlatXML                     = 19
+    Const wdFormatFlatXMLMacroEnabled         = 20
+    Const wdFormatFlatXMLTemplate             = 21
+    Const wdFormatFlatXMLTemplateMacroEnabled = 22
+    Const wdFormatHTML                        =  8
+    Const wdFormatPDF                         = 17
+    Const wdFormatRTF                         =  6
+    Const wdFormatTemplate                    =  1
+    Const wdFormatTemplate97                  =  1
+    Const wdFormatText                        =  2
+    Const wdFormatTextLineBreaks              =  3
+    Const wdFormatUnicodeText                 =  7
+    Const wdFormatWebArchive                  =  9
+    Const wdFormatXML                         = 11
+    Const wdFormatXMLDocument                 = 12
+    Const wdFormatXMLDocumentMacroEnabled     = 13
+    Const wdFormatXMLTemplate                 = 14
+    Const wdFormatXMLTemplateMacroEnabled     = 15
+    Const wdFormatXPS                         = 18
+
+    ' Create a File System object
+    Set objFSO = CreateObject( "Scripting.FileSystemObject" )
+
+    ' Create a Word object
+    Set objWord = CreateObject( "Word.Application" )
+
+    With objWord
+        ' True: make Word visible; False: invisible
+        .Visible = False
+
+        ' Check if the Word document exists
+        If objFSO.FileExists( inFile ) Then
+            Set objFile = objFSO.GetFile( inFile )
+            strFile = objFile.Path
+        Else
+            WScript.Echo "FILE OPEN ERROR: The file does not exist" & vbCrLf
+            ' Close Word
+            .Quit
+            Exit Sub
+        End If
+
+        'outHTML = objFSO.BuildPath( objFile.ParentFolder, _
+        '          objFSO.GetBaseName( objFile ) & ".html" )
+	'outHTML = outFile
+
+        ' Open the Word document
+        .Documents.Open strFile
+
+        ' Make the opened file the active document
+        Set objDoc = .ActiveDocument
+
+        ' Save as HTML
+        objDoc.SaveAs outHTML, wdFormatFilteredHTML
+
+        ' Close the active document
+        objDoc.Close
+
+        ' Close Word
+        .Quit
+    End With
+End Sub 
Index: /main/trunk/greenstone2/bin/script/gsConvert.pl
===================================================================
--- /main/trunk/greenstone2/bin/script/gsConvert.pl	(revision 24163)
+++ /main/trunk/greenstone2/bin/script/gsConvert.pl	(revision 24164)
@@ -789,5 +789,13 @@
 				       $ENV{'GSDLOS'}, "word2html");
 
-    $vbScript = "word2html" if ($ENV{'GSDLOS'} =~ m/^windows$/i);
+    if ($ENV{'GSDLOS'} =~ m/^windows$/i) {
+	# if windows scripting with docx input, use new VBscript
+	if($input_filename =~ m/docx$/i) {
+	    $vbScript = "docx2html.vbs"; 
+	} else { # use the usual word2html conversion VB executable
+	    $vbScript = "word2html";
+	}
+    }
+
     if (-e "$output_filestem.html") {
 	print STDERR "    The conversion file:\n";
@@ -811,5 +819,5 @@
     if (system($cmd)!=0)
     {
-	print STDERR "Error executing word2Html converter:$!\n";
+	print STDERR "Error executing $vbScript converter:$!\n";
 	if (-s "$output_filestem.err") {
 	    open (ERRFILE, "<$output_filestem.err");
