Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations bkrike on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

batch file to convert files 1

Status
Not open for further replies.

parker309

MIS
Jul 27, 2000
214
US
I have a directory with a number of large power point files. I would like to run a script against the directory to convert these ppt files to the smaller pdf format. I have Acrobat for doing this manually. I believe this to be a fairly simple batch file but am not that versed in scripts. Any help would be great. Thanks in advance.
 
Not really a 2k pro question. To produce a script to do this, you'll need a command line utility which will do the conversion - its not trivial. Doesn't Acrobat have a batch conversion feature? (Or you could Google for one).
 
Why don't you just use Acrobat distiller right from within ppt?
 
This folder contains over 500 ppt files that spread over the last four years. I do not want to have to open each file and print to the pdf maker. I am looking for a slick way to run a script against the folder and end up with 500 pdf's. I realize it might run for some time, but that is better that me sitting there and opening every file.

Thanks for your reply's.
 
Hello parker309,

It can be done by a vbscript. If you use PDF995 with omniformat, both free download out there, the steps are
[1] open up the file
[2] print using the PDF995 drive
and it will automatically print to a file of .pdf.

Now, the opening up one-by-one .ppt files can be done using powerpoint.application and filesystemobject, then printout method to .pdf can also be made available to the script.

If you need help on coming up the script, you have to give precise info because asking to supply code by imagination will be wasting much time if you cannot adapt the script by your own to more realistic situation.

regards - tsuji
 
Great. Thanks for the info. What exctly is the powerpoint.applicationa dn filesystemobject? Would this be a batch file that is run from the command line? Thanks in advance.
 
Tsuji,

For any directory, enumerate .ppt files, and convert to .pdf

Files to be stored in that directory with the original filename and a .pdf extension.

Directory path should be prompted.

As there are several reasonably priced commercial products for this, some integrated into Office, I think the first stop for this poster should be a Google on "convert ppt to pdf".
 
Hi Bill, thanks for the vote. (I have not really helped yet...)

parker309,

That confirms my fear that may be it is not the time yet for you to take the steps I map out. (No offense...)

I'll try though to inject more elements for your own exploring deeper.

We are talking about standalone vbscript (a kind of batch file). Now here is the core functionality for doing this task.
Code:
folderspec="d:\abc"    'your folder storing .ppt
set fso=createobject("scripting.filesystemobject")
for each f in fso.getfolder(folderspec).files
    if lcase(fso.getextensionname(f.name))="ppt" then
        wscript.echo f.path
    end if
next
set fso=nothing
If you test the script (named x.vbs) by edit folderspec to your own folder, it will echo out your .ppt file name. This shows you can get hold of the target files.

Now, once you get (or enumerate) all the targetted ppt file. You work on it with powerpoint in automation. The functionality is demo by this.
Code:
pptfilespec="d:\abc\def.ppt"

pdffilespec=replace(pptfilespec,".ppt",".pdf")
set oppt=createobject("powerpoint.application")
set oppp=oppt.presentations.open(pptfilespec)
sdefaultprinter=oppt.activeprinter
oppt.activeprinter="PDF995"    'PDF995 & omniformat installed
oppt.options.printbackground=false
oppp.printout ,,,pdffilespec
oppt.activeprinter=sdefaultprinter
oppp.close : set oppp=nothing
oppt.quit : set oppt=nothing

This will convert a file d:\abc\def.ppt. You can conceive a loop over all the candidate .ppt you get hold of previously.

Only, you must install free utility pdf995 and omniformat. (This may not please you, I don't know.)

The above is the outline of the automation.

- tsuji

 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top