Changeset 10628
- Timestamp:
- 2005-09-23T11:26:43+12:00 (19 years ago)
- Location:
- trunk/winbin/bin
- Files:
-
- 3 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/winbin/bin/pptextract.frm
r10571 r10628 35 35 Attribute VB_Exposed = False 36 36 Private Sub Form_Load() 37 Dim pa As PowerPoint.Application 38 Set pa = CreateObject("PowerPoint.Application") 39 pa.Visible = True 40 41 Dim ppts As PowerPoint.Presentations 42 Set ppts = pa.Presentations 37 'For solving the backward compatability of MS Automation with VB script 38 'We need to use the late binding technique, in which mean that we need to 39 'define all Office Automation variable as an Object first and it can then 40 'to decide the office version at run-tim. 41 Dim objPA As Object 42 Set objPA = CreateObject("PowerPoint.Application") 43 objPA.Visible = True 44 45 Dim objPPTs As Object 46 Set objPPTs = objPA.Presentations 43 47 44 48 htm = False … … 49 53 meta = False 50 54 51 'cmdln = "-g " & Chr(34) & " C:\chi\gsdl\collect\PPTTest2\import\16-A.ppt" & Chr(34) & Chr(34) & "C:\chi\gsdl\collect\PPTTest2\tmp\16-A" & Chr(34)55 '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) 52 56 cmdln = LCase(Command()) 53 57 'MsgBox ("Command:" + cmdln) … … 55 59 outputdir = getoutput(cmdln) 56 60 File = Left(cmdln, InStr(cmdln, ".ppt") + 3) 57 'MsgBox ("File:" + File)58 61 item_file = Left(cmdln, InStr(cmdln, ".ppt")) 59 62 args = getargs(File) 60 'MsgBox ("agr:" + args)61 63 direc = getdir(File) 62 'MsgBox ("direc:" + direc)63 64 File = getfile(File) 64 'MsgBox ("File:" + File) 65 65 66 66 item_file = getfile(item_file) 67 68 If InStr(args, "h") Then htm = True67 'We don't use this script to convert the PPT to html, instead, we use 68 'the open source come with Greenstone package 69 69 If InStr(args, "j") Then jpg = True 70 70 If InStr(args, "g") Then gif = True 71 71 If InStr(args, "p") Then png = True 72 If InStr(args, "o") Then old = True 73 If InStr(args, "m") Then meta = True 74 75 Dim item, text 76 'As Object 77 Dim fso 72 73 Dim item, text As Object 74 Dim fso As Object 78 75 Set fso = CreateObject("Scripting.FileSystemObject") 79 76 80 ' Modified for apply to GSII environment setting 81 'MsgBox ("OUTPUT_dir:" + outputdir) 77 'Modified for apply to GSII environment setting 82 78 output_tmp = Left(outputdir, InStr(outputdir, "\tmp") + 3) 83 79 'output_tmp = Mid(outputdir, 2, InStr(outputdir, "\tmp") + 3) … … 109 105 Source = direc + File 110 106 'MsgBox ("Src:" + Source) 111 ppts.Open (Source)107 objPPTs.Open (Source) 112 108 113 109 'do stuff … … 115 111 Dim slide_shape As Shape 116 112 j = 2 117 For slide_count = 1 To ppts(1).Slides.Count118 current_slide = ppts(1).Slides(slide_count).Name113 For slide_count = 1 To objPPTs(1).Slides.Count 114 current_slide = objPPTs(1).Slides(slide_count).Name 119 115 'generate a text version 120 116 Set text = fso.CreateTextFile(outputdir + "\Slide" + CStr(slide_count) + ".txt", ForWriting, True) 121 'Set text = CreateObject("ADODB.Stream") 122 'text.Open 123 'text.Position = 0 124 'text.Charset = "UTF-8" 125 If (ppts(1).Slides(slide_count).Shapes.HasTitle) Then 126 slide_title = ppts(1).Slides(slide_count).Shapes.Title.TextFrame.TextRange 117 If (objPPTs(1).Slides(slide_count).Shapes.HasTitle) Then 118 slide_title = objPPTs(1).Slides(slide_count).Shapes.Title.TextFrame.TextRange 127 119 Else 128 slide_title = ppts(1).Slides(slide_count).Name120 slide_title = objPPTs(1).Slides(slide_count).Name 129 121 End If 130 122 slide_text = "" 131 123 found_text = True 132 For iShape = 1 To ppts(1).Slides(slide_count).Shapes.Count133 If ( ppts(1).Slides(slide_count).Shapes(iShape).TextFrame.HasText) Then134 slide_text = ppts(1).Slides(slide_count).Shapes(iShape).TextFrame.TextRange.text124 For iShape = 1 To objPPTs(1).Slides(slide_count).Shapes.Count 125 If (objPPTs(1).Slides(slide_count).Shapes(iShape).TextFrame.HasText) Then 126 slide_text = objPPTs(1).Slides(slide_count).Shapes(iShape).TextFrame.TextRange.text 135 127 'MsgBox ("Slide_text:" + slide_text) 136 128 If slide_text <> "" Then … … 139 131 Else 140 132 text.WriteLine ("This slide has no text") 141 'text.WriteText ("This slide has no text")142 133 End If 143 134 End If … … 147 138 'text.Close 148 139 'j = j + 1 149 If ppts(1).Slides.Count >= 1 And slide_count < ppts(1).Slides.Count Then150 next_slide = ppts(1).Slides(slide_count + 1).Name140 If objPPTs(1).Slides.Count >= 1 And slide_count < objPPTs(1).Slides.Count Then 141 next_slide = objPPTs(1).Slides(slide_count + 1).Name 151 142 Else 152 143 nextf = " " 153 144 End If 154 145 If htm Then 155 ' Not developed for convertto html yet146 'Not developed for converting to html yet 156 147 'Currently, if the user choose to convert the PPT to the html file 157 'We will only allow users to use the open source method 148 'We will only allow users to use the open source method through Greenstone 158 149 End If 159 150 If gif Then … … 201 192 'ppts(1).SaveAs outputdir, ppSaveAsHTMLv3 202 193 ElseIf gif Then 203 ppts(1).SaveAs outputdir, ppSaveAsGIF194 objPPTs(1).SaveAs outputdir, ppSaveAsGIF 204 195 ElseIf jpg Then 205 ppts(1).SaveAs outputdir, ppSaveAsJPG196 objPPTs(1).SaveAs outputdir, ppSaveAsJPG 206 197 ElseIf png Then 207 ppts(1).SaveAs outputdir, ppSaveAsPNG198 objPPTs(1).SaveAs outputdir, ppSaveAsPNG 208 199 End If 209 200 … … 213 204 'item.SaveToFile outputdir + "\" + item_file + "item" 214 205 item.Close 215 ppts(1).Close206 objPPTs(1).Close 216 207 Set fso = Nothing 217 208 Set text = Nothing 218 209 Set item = Nothing 219 pa.Quit210 objPA.Quit 220 211 End 221 212 End Sub 222 213 Function getoutput(line) 223 'MsgBox ("CMDLN:" + line)224 214 cmdln = line 225 215 While InStr(cmdln, ".ppt") 226 'cmdln = LTrim(RTrim(Right(cmdln, Len(cmdln) - (InStr(cmdln, ".ppt") + 4))))227 216 cmdln = Trim(Right(cmdln, Len(cmdln) - (InStr(cmdln, ".ppt") + 4))) 228 217 cmdln = Trim(Mid(cmdln, 2, Len(cmdln) - 2)) 229 218 Wend 230 219 getoutput = cmdln 231 'MsgBox ("OUTPUTDIR:" + getoutput) 232 End Function 220 End Function 233 221 Function getargs(line) 234 222 x = LTrim(line) … … 249 237 Wend 250 238 getdir = direc 251 'MsgBox ("GetDIr:" + getdir)252 239 End Function 253 240 Function getfile(line) … … 257 244 Wend 258 245 getfile = x 259 246 End Function 260 247 Sub itemxml(out_item, thisfile, txtfile, num, slide_title) 261 248 out_item.WriteLine (" <Page pagenum=" + Chr(34) + CStr(num) + Chr(34) + " imgfile=" + Chr(34) + thisfile + Chr(34) + " txtfile=" + Chr(34) + txtfile + Chr(34) + ">") -
trunk/winbin/bin/pptextract.vbp
r10571 r10628 1 1 Type=Exe 2 Reference=*\G{00020430-0000-0000-C000-000000000046}#2.0#0#C:\WINDOWS\system32\ STDOLE2.TLB#OLE Automation2 Reference=*\G{00020430-0000-0000-C000-000000000046}#2.0#0#C:\WINDOWS\system32\stdole2.tlb#OLE Automation 3 3 Reference=*\G{91493440-5A91-11CF-8700-00AA0060263B}#2.6#0#C:\Program Files\Microsoft Office\OFFICE11\MSPPT.OLB#Microsoft PowerPoint 9.0 Object Library 4 4 Form=pptextract.frm 5 IconForm="Form1"6 5 Startup="Form1" 7 6 ExeName32="pptextract.exe"
Note:
See TracChangeset
for help on using the changeset viewer.