Index: /other-projects/trunk/winbin/bin/pptextract.frm
===================================================================
--- /other-projects/trunk/winbin/bin/pptextract.frm	(revision 14163)
+++ /other-projects/trunk/winbin/bin/pptextract.frm	(revision 14163)
@@ -0,0 +1,274 @@
+VERSION 5.00
+Begin VB.Form Form1 
+   Caption         =   "Form1"
+   ClientHeight    =   1380
+   ClientLeft      =   60
+   ClientTop       =   450
+   ClientWidth     =   3825
+   LinkTopic       =   "Form1"
+   ScaleHeight     =   1380
+   ScaleWidth      =   3825
+   StartUpPosition =   3  'Windows Default
+   Begin VB.Label W 
+      Alignment       =   2  'Center
+      Caption         =   "Word to HTML"
+      BeginProperty Font 
+         Name            =   "MS Sans Serif"
+         Size            =   24
+         Charset         =   0
+         Weight          =   400
+         Underline       =   0   'False
+         Italic          =   0   'False
+         Strikethrough   =   0   'False
+      EndProperty
+      Height          =   615
+      Left            =   360
+      TabIndex        =   0
+      Top             =   360
+      Width           =   3375
+   End
+End
+Attribute VB_Name = "Form1"
+Attribute VB_GlobalNameSpace = False
+Attribute VB_Creatable = False
+Attribute VB_PredeclaredId = True
+Attribute VB_Exposed = False
+Private Sub Form_Load()
+    'For solving the backward compatability of MS Automation with VB script
+    'We need to use the late binding technique, in which mean that we need to
+    'define all Office Automation variable as an Object first and it can then
+    'to decide the office version at run-tim.
+    Dim objPA As Object
+    Set objPA = CreateObject("PowerPoint.Application")
+    objPA.Visible = True
+    
+    Dim objPPTs As Object
+    Set objPPTs = objPA.Presentations
+            
+    htm = False
+    jpg = False
+    gif = False
+    old = False
+    png = False
+    meta = False
+    
+    'cmdln = "-g " & Chr(34) & "H:\chi\gsdl\collect\PPTTest\import\LITA-2004.ppt" & Chr(34) & Chr(34) & "H:\chi\gsdl\collect\PPTTest\tmp\LITA-2004" & Chr(34)
+    cmdln = LCase(Command())
+    'MsgBox ("Command:" + cmdln)
+    'cmdln = "-g H:\chi\Visual Basic\ForumPres270404.ppt H:\chi\Visual Basic\tmp\ForumPres270404"
+    outputdir = getoutput(cmdln)
+    File = Left(cmdln, InStr(cmdln, ".ppt") + 3)
+    item_file = Left(cmdln, InStr(cmdln, ".ppt"))
+    args = getargs(File)
+    direc = getdir(File)
+    File = getfile(File)
+       
+    item_file = getfile(item_file)
+    'We don't use this script to convert the PPT to html, instead, we use
+    'the open source come with Greenstone package
+    If InStr(args, "j") Then jpg = True
+    If InStr(args, "g") Then gif = True
+    If InStr(args, "p") Then png = True
+    
+    Dim item, text As Object
+    Dim fso As Object
+    Set fso = CreateObject("Scripting.FileSystemObject")
+    
+    'Modified for apply to GSII environment setting
+    output_tmp = Left(outputdir, InStr(outputdir, "\tmp") + 3)
+    'output_tmp = Mid(outputdir, 2, InStr(outputdir, "\tmp") + 3)
+    'MsgBox ("OUTPUT_TMP:" + output_tmp)
+    
+    If Not fso.FolderExists(output_tmp) Then
+       fso.CreateFolder (output_tmp)
+       If Not fso.FolderExists(outputdir) Then
+             fso.CreateFolder (outputdir)
+        End If
+    Else
+        If Not fso.FolderExists(outputdir) Then
+             fso.CreateFolder (outputdir)
+        End If
+    End If
+    
+    'generate document_name.item file
+    Set item = fso.CreateTextFile(outputdir + "\" + item_file + "item", ForWriting, True)
+    'Set item = CreateObject("ADODB.Stream")
+    'item.Open
+    'item.Position = 0
+    'item.Charset = "UTF-8"
+    
+    'Print #3, "<?xml version=" + Chr(34) + "1.0" + Chr(34) + " encoding=" + Chr(34) + "UTF-8" + Chr(34) + " standalone=" + Chr(34) + "no" + Chr(34) + "?>"
+    'Print #3, "<!DOCTYPE DirectoryMetadata SYSTEM " + Chr(34) + "http://greenstone.org/dtd/DirectoryMetadata/1.0/DirectoryMetadata.dtd" + Chr(34) + ">"
+    'Print #1, "<PagedDocument>"
+    item.WriteLine ("<PagedDocument>")
+    'item.WriteText "<PagedDocument>", 1
+    Source = direc + File
+    'MsgBox ("Src:" + Source)
+    objPPTs.Open (Source)
+                           
+    'do stuff
+    n = 1
+    Dim slide_shape As Shape
+    j = 2
+    For slide_count = 1 To objPPTs(1).Slides.Count
+        current_slide = objPPTs(1).Slides(slide_count).Name
+        'generate a text version
+        Set text = fso.CreateTextFile(outputdir + "\Slide" + CStr(slide_count) + ".txt", ForWriting, True)
+        If (objPPTs(1).Slides(slide_count).Shapes.HasTitle) Then
+            slide_title = objPPTs(1).Slides(slide_count).Shapes.Title.TextFrame.TextRange
+        Else
+            slide_title = objPPTs(1).Slides(slide_count).Name
+        End If
+        slide_text = ""
+        found_text = True
+        For iShape = 1 To objPPTs(1).Slides(slide_count).Shapes.Count
+            If (objPPTs(1).Slides(slide_count).Shapes(iShape).TextFrame.HasText) Then
+                slide_text = objPPTs(1).Slides(slide_count).Shapes(iShape).TextFrame.TextRange.text
+                'MsgBox ("Slide_text:" + slide_text)
+                If slide_text <> "" Then
+                    text.WriteLine (slide_text)
+                    'text.WriteText (slide_text)
+                Else
+                    text.WriteLine ("This slide has no text")
+                End If
+            End If
+        Next iShape
+        'text_file = outputdir + "\Slide" + CStr(slide_count) + ".txt"
+        'text.SaveToFile text_file
+        'text.Close
+        'j = j + 1
+        If objPPTs(1).Slides.Count >= 1 And slide_count < objPPTs(1).Slides.Count Then
+            next_slide = objPPTs(1).Slides(slide_count + 1).Name
+        Else
+            nextf = " "
+        End If
+        If htm Then
+            'Not developed for converting to html yet
+            'Currently, if the user choose to convert the PPT to the html file
+            'We will only allow users to use the open source method through Greenstone
+        End If
+        If gif Then
+            current_slide = "Slide" + CStr(n)
+            If nextf <> " " Then
+                nextf = outputdir + "\" + "Slide" + CStr(n + 1)
+            End If
+            prevhtml = outputdir + "\" + current_slide + ".gif"
+            If slide_text = "" Then
+               itemxml item, current_slide + ".gif", "", n, slide_title
+            Else
+               itemxml item, current_slide + ".gif", current_slide + ".txt", n, slide_title
+            End If
+        End If
+        If jpg Then
+            current_slide = "Slide" + CStr(n)
+            If nextf <> " " Then
+                nextf = outputdir + "\" + "Slide" + CStr(n + 1)
+            End If
+            prevhtml = outputdir + "\" + current_slide + ".jpg"
+            If slide_text = "" Then
+                itemxml item, current_slide + ".jpg", "", n, slide_title
+            Else
+                itemxml item, current_slide + ".jpg", current_slide + ".txt", n, slide_title
+            End If
+        End If
+        If png Then
+            current_slide = "Slide" + CStr(n)
+            If nextf <> " " Then
+                nextf = outputdir + "\" + "Slide" + CStr(n + 1)
+            End If
+            prevhtml = outputdir + "\" + current_slide + ".png"
+            If slide_text = "" Then
+                itemxml item, current_slide + ".png", "", n, slide_title
+            Else
+                itemxml item, current_slide + ".png", current_slide + ".txt", n, slide_title
+            End If
+        End If
+        n = n + 1
+        item.WriteLine ("   </Page>")
+        'item.WriteText "   </Page>", 1
+    Next
+    i = 0
+    If htm Then
+        'ppts(1).SaveAs outputdir, ppSaveAsHTMLv3
+    ElseIf gif Then
+        objPPTs(1).SaveAs outputdir, ppSaveAsGIF
+    ElseIf jpg Then
+        objPPTs(1).SaveAs outputdir, ppSaveAsJPG
+    ElseIf png Then
+        objPPTs(1).SaveAs outputdir, ppSaveAsPNG
+    End If
+                
+    item.WriteLine ("</PagedDocument>")
+    'item.WriteText "</PagedDocument>", 1
+    'objStream.SaveToFile pstrFile
+    'item.SaveToFile outputdir + "\" + item_file + "item"
+    item.Close
+    objPPTs(1).Close
+    Set fso = Nothing
+    Set text = Nothing
+    Set item = Nothing
+    objPA.Quit
+End
+End Sub
+Function getoutput(line)
+    cmdln = line
+    While InStr(cmdln, ".ppt")
+        cmdln = Trim(Right(cmdln, Len(cmdln) - (InStr(cmdln, ".ppt") + 4)))
+        cmdln = Trim(Mid(cmdln, 2, Len(cmdln) - 2))
+    Wend
+    getoutput = cmdln
+    End Function
+Function getargs(line)
+    x = LTrim(line)
+    If InStr(x, "-") = 1 Then
+        getargs = Left(line, InStr(line, " "))
+    End If
+End Function
+Function getdir(line)
+    x = LTrim(Right(line, Len(line) - Len(getargs(line)) - 1))
+    If InStr(x, ":") <> 2 Then
+        direc = CurDir
+        If Right(direc, 1) <> "\" Then direc = direc + "\"
+    End If
+    
+    While InStr(x, "\")
+        direc = direc + Left(x, InStr(x, "\"))
+        x = Right(x, Len(x) - InStr(x, "\"))
+    Wend
+    getdir = direc
+End Function
+Function getfile(line)
+    x = LTrim(Right(line, Len(line) - Len(getargs(line))))
+    While InStr(x, "\")
+        x = Right(x, Len(x) - InStr(x, "\"))
+    Wend
+    getfile = x
+End Function
+Sub itemxml(out_item, thisfile, txtfile, num, slide_title)
+    out_item.WriteLine ("   <Page pagenum=" + Chr(34) + CStr(num) + Chr(34) + " imgfile=" + Chr(34) + thisfile + Chr(34) + " txtfile=" + Chr(34) + txtfile + Chr(34) + ">")
+    'out_item.WriteText "   <Page pagenum=" + Chr(34) + CStr(num) + Chr(34) + " imgfile=" + Chr(34) + thisfile + Chr(34) + " txtfile=" + Chr(34) + txtfile + Chr(34) + ">", 1
+    If slide_title <> "" Then
+        out_item.WriteLine ("      <Metadata name=" + Chr(34) + "Title" + Chr(34) + ">" + slide_title + "</Metadata>")
+        'MsgBox ("Title:" + slide_title)
+        'out_item.WriteText "      <Metadata name=" + Chr(34) + "Title" + Chr(34) + ">" + slide_title + "</Metadata>", 1
+    End If
+ End Sub
+Function checknext(filename, extention)
+    If filename = "" Then
+        checknext = ""
+    Else
+        checknext = filename + extention
+    End If
+End Function
+Function replaceStrings(f, c, W)
+s = f
+t = ""
+While InStr(s, c)
+    t = t + Left(s, InStr(s, c) - 1) + W
+    s = Right(s, Len(s) - (InStr(s, c) + Len(c)) + 1)
+Wend
+replaceStrings = t + s
+End Function
+Function fixnum(s)
+    fixnum = String(4 - Len(s), "0") + s
+End Function
Index: /other-projects/trunk/winbin/bin/pptextract.vbp
===================================================================
--- /other-projects/trunk/winbin/bin/pptextract.vbp	(revision 14163)
+++ /other-projects/trunk/winbin/bin/pptextract.vbp	(revision 14163)
@@ -0,0 +1,34 @@
+Type=Exe
+Reference=*\G{00020430-0000-0000-C000-000000000046}#2.0#0#C:\WINDOWS\system32\stdole2.tlb#OLE Automation
+Reference=*\G{91493440-5A91-11CF-8700-00AA0060263B}#2.6#0#C:\Program Files\Microsoft Office\OFFICE11\MSPPT.OLB#Microsoft PowerPoint 9.0 Object Library
+Form=pptextract.frm
+Startup="Form1"
+ExeName32="pptextract.exe"
+Command32=""
+Name="Project1"
+HelpContextID="0"
+CompatibleMode="0"
+MajorVer=1
+MinorVer=0
+RevisionVer=0
+AutoIncrementVer=0
+ServerSupportFiles=0
+VersionCompanyName="University Of Waikato"
+CompilationType=0
+OptimizationType=0
+FavorPentiumPro(tm)=0
+CodeViewDebugInfo=0
+NoAliasing=0
+BoundsCheck=0
+OverflowCheck=0
+FlPointCheck=0
+FDIVCheck=0
+UnroundedFP=0
+StartMode=0
+Unattended=0
+Retained=0
+ThreadPerObject=0
+MaxNumberOfThreads=1
+
+[MS Transaction Server]
+AutoRefresh=1
Index: /other-projects/trunk/winbin/bin/pptextract.vbw
===================================================================
--- /other-projects/trunk/winbin/bin/pptextract.vbw	(revision 14163)
+++ /other-projects/trunk/winbin/bin/pptextract.vbw	(revision 14163)
@@ -0,0 +1,1 @@
+Form1 = -253, 52, 704, 613, C, 22, 22, 455, 462, C
Index: /other-projects/trunk/winbin/bin/word2html.frm
===================================================================
--- /other-projects/trunk/winbin/bin/word2html.frm	(revision 14163)
+++ /other-projects/trunk/winbin/bin/word2html.frm	(revision 14163)
@@ -0,0 +1,119 @@
+VERSION 5.00
+Begin VB.Form Form1 
+   Caption         =   "Form1"
+   ClientHeight    =   1380
+   ClientLeft      =   60
+   ClientTop       =   450
+   ClientWidth     =   3825
+   LinkTopic       =   "Form1"
+   ScaleHeight     =   1380
+   ScaleWidth      =   3825
+   StartUpPosition =   3  'Windows Default
+   Begin VB.Label W 
+      Alignment       =   2  'Center
+      Caption         =   "Word to HTML"
+      BeginProperty Font 
+         Name            =   "MS Sans Serif"
+         Size            =   24
+         Charset         =   0
+         Weight          =   400
+         Underline       =   0   'False
+         Italic          =   0   'False
+         Strikethrough   =   0   'False
+      EndProperty
+      Height          =   615
+      Left            =   360
+      TabIndex        =   0
+      Top             =   360
+      Width           =   3375
+   End
+End
+Attribute VB_Name = "Form1"
+Attribute VB_GlobalNameSpace = False
+Attribute VB_Creatable = False
+Attribute VB_PredeclaredId = True
+Attribute VB_Exposed = False
+
+Private Sub Form_Load()
+    'For solving the backward compatability of MS Automation with VB script
+    'We need to use the late binding technique, in which mean that we need to
+    'define all Office Automation variable as an Object first and it can then
+    'to decide the office version at run-tim.
+    
+    'Creat a Word Application
+    Dim objWA As Object
+    Set objWA = CreateObject("Word.Application")
+    objWA.Visible = True
+    
+    Dim cmdln As String
+    Dim src As String
+    Dim dst As String
+       
+    cmdln = LCase(Command())
+    'MsgBox ("Command:" + cmdln)
+    'cmdln = Chr(34) & "H:\chi\gsdl\collect\WordTest\import\word03_01.doc" & Chr(34) & Chr(34) & "H:\chi\gsdl\collect\WordTest\tmp\word03_01.html" & Chr(34)
+    src = Trim(Left(cmdln, (InStr(cmdln, ".doc") + 4)))
+    src = Mid(src, 2, Len(src) - 2)
+    'MsgBox ("Src:" + src)
+    If InStr(src, ":") <> 2 Then src = CurDir + "\" + src
+    dst = Trim(Right(cmdln, Len(cmdln) - (InStr(cmdln, ".doc") + 4)))
+    dst = Mid(dst, 2, Len(dst) - 2)
+    If InStr(dst, ":") <> 2 Then dst = CurDir + "\" + dst
+        
+    
+    'Create a Word Document Object and Open a Word Document
+    Dim objWD As Object
+    Set objWD = objWA.Documents
+    
+    objWD.Open (src)
+    objWD(1).SaveAs dst, wdFormatHTML
+    objWD(1).Close
+
+    ' Quite Word Application
+    objWA.Quit
+    
+    'Release Objects
+    Set objWA = Nothing
+    Set objWD = Nothing
+
+    End
+End Sub
+Function getoutput(line)
+    cmdln = line
+    While InStr(cmdln, ".ppt")
+        cmdln = LTrim(Right(cmdln, Len(cmdln) - (InStr(cmdln, ".ppt") + 3)))
+    Wend
+    If Right(CurDir, 1) = "\" Then cmdln = CurDir + cmdln Else cmdln = CurDir + "\" + cmdln
+    If LTrim(cmdln) = "" Then cmdln = cmdln + "out"
+    If Right(cmdln, 1) <> "\" Then cmdln = cmdln + "\"
+    getoutput = cmdln
+End Function
+
+Function getargs(line)
+    x = LTrim(line)
+    If InStr(x, "-") = 1 Then
+        getargs = Left(line, InStr(line, " "))
+    End If
+End Function
+
+Function getdir(line)
+    x = LTrim(Right(line, Len(line) - Len(getargs(line))))
+    If InStr(x, ":") <> 2 Then
+        direc = CurDir
+        If Right(direc, 1) <> "\" Then direc = direc + "\"
+    End If
+    
+    While InStr(x, "\")
+        direc = direc + Left(x, InStr(x, "\"))
+        x = Right(x, Len(x) - InStr(x, "\"))
+    Wend
+    getdir = direc
+End Function
+
+Function getfile(line)
+    x = LTrim(Right(line, Len(line) - Len(getargs(line))))
+    While InStr(x, "\")
+        x = Right(x, Len(x) - InStr(x, "\"))
+    Wend
+    getfile = x
+End Function
Index: /other-projects/trunk/winbin/bin/word2html.vbp
===================================================================
--- /other-projects/trunk/winbin/bin/word2html.vbp	(revision 14163)
+++ /other-projects/trunk/winbin/bin/word2html.vbp	(revision 14163)
@@ -0,0 +1,37 @@
+Type=Exe
+Reference=*\G{00020430-0000-0000-C000-000000000046}#2.0#0#C:\WINDOWS\system32\stdole2.tlb#OLE Automation
+Reference=*\G{91493440-5A91-11CF-8700-00AA0060263B}#2.7#0#C:\Program Files\Microsoft Office\OFFICE11\MSPPT.OLB#Microsoft PowerPoint 10.0 Object Library
+Reference=*\G{00020905-0000-0000-C000-000000000046}#8.2#0#C:\Program Files\Microsoft Office\OFFICE11\MSWORD.OLB#Microsoft Word 10.0 Object Library
+Form=word2html.frm
+IconForm="Form1"
+Startup="Form1"
+HelpFile=""
+ExeName32="word2html.exe"
+Command32=""
+Name="Project1"
+HelpContextID="0"
+CompatibleMode="0"
+MajorVer=1
+MinorVer=0
+RevisionVer=0
+AutoIncrementVer=0
+ServerSupportFiles=0
+VersionCompanyName="University Of Waikato"
+CompilationType=0
+OptimizationType=0
+FavorPentiumPro(tm)=0
+CodeViewDebugInfo=0
+NoAliasing=0
+BoundsCheck=0
+OverflowCheck=0
+FlPointCheck=0
+FDIVCheck=0
+UnroundedFP=0
+StartMode=0
+Unattended=0
+Retained=0
+ThreadPerObject=0
+MaxNumberOfThreads=1
+
+[MS Transaction Server]
+AutoRefresh=1
Index: /other-projects/trunk/winbin/bin/word2html.vbw
===================================================================
--- /other-projects/trunk/winbin/bin/word2html.vbw	(revision 14163)
+++ /other-projects/trunk/winbin/bin/word2html.vbw	(revision 14163)
@@ -0,0 +1,1 @@
+Form1 = -411, 30, 601, 642, Z, 44, 58, 1056, 670, C
