- Timestamp:
- 2013-10-04T19:18:48+13:00 (11 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
main/trunk/binaries/windows/bin/pptextract.vbs
r28353 r28354 1 ' This file is a port to VBScript from VB of the pptextract.exe, pptextract.frm (and pptextract.vbp) files. 2 3 ' It was hard to upgrade the VB pptextract.frm form script in Visual Studio 4 ' to the current Visual Basic, and some packages it needed wouldn't install, 5 ' making it hard to compile up. 6 7 ' As this VBScript doesn't need to be compiled up, it may be easier to maintain. 8 9 ' For differences between VBScript and VB, see 10 ' http://msdn.microsoft.com/en-us/library/ms970436.aspx 11 ' http://www.htmlgoodies.com/beyond/asp/vbs-ref/article.php/3458611/Key-Differences-Between-VB-and-VB-Script.htm 12 ' (Note that VBScript does support reading and writing to files) 13 14 15 1 16 'Option Explicit 2 17 'Imports PowerPoint = Microsoft.Office.Interop.PowerPoint … … 8 23 ' If you want the code to work, you have to use cscript.exe to run it. 9 24 10 25 ' This is a CScript (console-only). If launched in WScript mode, run as CScript anyway 26 ' From: http://stackoverflow.com/questions/4692542/force-a-vbs-to-run-using-cscript-instead-of-wscript 27 Sub forceCScriptExecution 28 Dim Arg, Str 29 If Not LCase( Right( WScript.FullName, 12 ) ) = "\cscript.exe" Then 30 For Each Arg In WScript.Arguments 31 If InStr( Arg, " " ) Then Arg = """" & Arg & """" 32 Str = Str & " " & Arg 33 Next 34 CreateObject( "WScript.Shell" ).Run _ 35 "cscript //nologo """ & _ 36 WScript.ScriptFullName & _ 37 """ " & Str 38 WScript.Quit 39 End If 40 End Sub 41 forceCScriptExecution 42 43 ' Where this script actually starts 11 44 Dim args 12 45 args = WScript.Arguments.Count … … 92 125 Sub PPTslidesToImgs(outputType, inFileName, outFileStem) 93 126 ' switch statement, http://msdn.microsoft.com/en-us/library/6ef9w614%28v=vs.84%29.aspx 94 WScript.StdErr.Write ("Output stem: " & outFileStem & vbCrLf)127 'WScript.StdErr.Write ("Output stem: " & outFileStem & vbCrLf) 95 128 96 129 Dim fso … … 102 135 itemFile = Mid(outFileStem, InStrRev(outFileStem, "\")+1) 103 136 104 WScript.StdErr.Write ("outputDir: " & outFileStem & vbCrLf)137 'WScript.StdErr.Write ("outputDir: " & outFileStem & vbCrLf) 105 138 106 139 If Not fso.FolderExists(outputDir) Then … … 130 163 itemFile = outFileStem + "\" + itemFile + ".item" 131 164 132 'Set item = fso.CreateTextFile(itemFile, 2, True) ' ForWriting = 2,Unicode = -1, see http://msdn.microsoft.com/en-us/library/314cz14s%28v=vs.84%29.aspx133 134 ' Writing out to a file in UTF-8 http://stackoverflow.com/questions/10450156/write-text-file-in-appending-utf-8-encoded-in-vb6165 'Set item = fso.CreateTextFile(itemFile, 2, True) ' ForWriting = 2, default is Unicode = -1, see http://msdn.microsoft.com/en-us/library/314cz14s%28v=vs.84%29.aspx 166 ' The default file-write methods in VBScript all create UTF16 Little Endian (USC-2LE) files like Notepad's default, rather than the UTF-8 we want 167 ' Writing out to a file in UTF-8 is achieved as at: http://stackoverflow.com/questions/10450156/write-text-file-in-appending-utf-8-encoded-in-vb6 135 168 Dim item 136 169 Set item = CreateObject("ADODB.Stream")
Note:
See TracChangeset
for help on using the changeset viewer.