vbscript - Running VBS script from PHP to convert ppt into pdf not saving file into design target -


i have vbs script convers .ppt file .pdf file (script shown below). , have 2 shared network drives. 1 need load input data , second wana save output file.

first tested in basic command line command this

cscript ppt2txt.vbs \\149.223.22.11\cae\04_knowledge-base\20110414-br231-cii45he-320x24-pad-chamfer.ppt \\sjabcz-vyv-bck\cae\out.pdf 

and everythings works well. moved next step, run via php on server (serves located ot network drive wana save output file). made simple php line of code looks this

echo exec("cscript ppt2txt.vbs \\\\149.223.22.11\\cae\\04_knowledge-base\\20110414-br231-cii45he-320x24-pad-chamfer.ppt \\\\sjabcz-vyv-bck\\cae\\out.pdf"); 

but shows

output file: \sjabcz-vyv-bck\cae\out.pdf

and no file created. im curious can bad here, if in command line everythings works charm, php short it.

and vbs code

option explicit  sub writeline ( strline )     wscript.stdout.writeline strline end sub  ' http://msdn.microsoft.com/en-us/library/office/aa432714(v=office.12).aspx const msofalse = 0   ' false. const msotrue = -1   ' true.  ' http://msdn.microsoft.com/en-us/library/office/bb265636(v=office.12).aspx const ppfixedformatintentscreen = 1 ' intent view exported file on screen. const ppfixedformatintentprint = 2  ' intent print exported file.  ' http://msdn.microsoft.com/en-us/library/office/ff746754.aspx const ppfixedformattypexps = 1  ' xps format const ppfixedformattypepdf = 2  ' pdf format  ' http://msdn.microsoft.com/en-us/library/office/ff744564.aspx const ppprinthandoutverticalfirst = 1   ' slides ordered vertically, first slide in upper-left corner , second slide below it. const ppprinthandouthorizontalfirst = 2 ' slides ordered horizontally, first slide in upper-left corner , second slide right of it.  ' http://msdn.microsoft.com/en-us/library/office/ff744185.aspx const ppprintoutputslides = 1               ' slides const ppprintoutputtwoslidehandouts = 2     ' 2 slide handouts const ppprintoutputthreeslidehandouts = 3   ' 3 slide handouts const ppprintoutputsixslidehandouts = 4     ' 6 slide handouts const ppprintoutputnotespages = 5           ' notes pages const ppprintoutputoutline = 6              ' outline const ppprintoutputbuildslides = 7          ' build slides const ppprintoutputfourslidehandouts = 8    ' 4 slide handouts const ppprintoutputnineslidehandouts = 9    ' 9 slide handouts const ppprintoutputoneslidehandouts = 10    ' single slide handouts  ' http://msdn.microsoft.com/en-us/library/office/ff745585.aspx const ppprintall = 1            ' print slides in presentation. const ppprintselection = 2      ' print selection of slides. const ppprintcurrent = 3        ' print current slide presentation. const ppprintsliderange = 4     ' print range of slides. const ppprintnamedslideshow = 5 ' print named slideshow.  ' http://msdn.microsoft.com/en-us/library/office/ff744228.aspx const ppshowall = 1             ' show all. const ppshownamedslideshow = 3  ' show named slideshow. const ppshowsliderange = 2      ' show slide range.  ' ' actual script '  dim inputfile dim outputfile dim objppt dim objpresentation dim objprintoptions dim objfso  if wscript.arguments.count <> 2     writeline "you need specify input , output files."     wscript.quit end if  inputfile = wscript.arguments(0) outputfile = wscript.arguments(1)  set objfso = createobject("scripting.filesystemobject")  if not objfso.fileexists( inputfile )     writeline "unable find input file " & inputfile     wscript.quit end if  if objfso.fileexists( outputfile )     writeline "your output file (' & outputfile & ') exists!"     wscript.quit end if  writeline "input file:  " & inputfile writeline "output file: " & outputfile  set objppt = createobject( "powerpoint.application" )  objppt.visible = true objppt.presentations.open inputfile  set objpresentation = objppt.activepresentation set objprintoptions = objpresentation.printoptions  objprintoptions.ranges.add 1,objpresentation.slides.count objprintoptions.rangetype = ppshowall   ' reference @ http://msdn.microsoft.com/en-us/library/office/ff746080.aspx objpresentation.exportasfixedformat outputfile, ppfixedformattypepdf, ppfixedformatintentscreen, msotrue, ppprinthandouthorizontalfirst, ppprintoutputslides, msofalse, objprintoptions.ranges(1), ppprintall, "slideshow name", false, false, false, false, false  objpresentation.close objppt.quit 


Comments

Popular posts from this blog

javascript - Laravel datatable invalid JSON response -

java - Exception in thread "main" org.springframework.context.ApplicationContextException: Unable to start embedded container; -

sql server 2008 - My Sql Code Get An Error Of Msg 245, Level 16, State 1, Line 1 Conversion failed when converting the varchar value '8:45 AM' to data type int -