Jump to content

Open/Convert ALL files in a directory...???


 Share

Recommended Posts

I have thousands of old PageMaker files which I want to dump in a directory, and open/save each one of them as PDF or HTML-- anything but PageMaker, which is a dead format going forward.

But for the sake of simplicity, I would simply like to see an .au3 module which does something like this:

  1. Loops through every file in a directory (assume they are all Microsoft Word files).
  2. Opens each one with Microsoft Word.
  3. Saves each one in the same directory as PDF or the older 97-2003 Word format (just something different).

I looked in the "AutoIt Example Scripts" but didn't see anything like this...  Can anyone point me to such an example, or simply create one (if it is not too difficult)?  I am totally new to AutoIT, so any help would be greatly appreciated.

Thanks in advance,

Paul.

Link to comment
Share on other sites

Use the Word UDF to open the file, and save it to PDF :

#include <Word.au3>

Local $oWord = _Word_Create(False)
Local $oDoc = _Word_DocOpen($oWord, @ScriptDir & "\theFile.doc")
_Word_DocSaveAs($oDoc, @ScriptDir & "\theFile.pdf", $wdFormatPDF)
_Word_Quit($oWord)

 

Link to comment
Share on other sites

Thanks, but... the "Word" example was just for the sake of an example (because everyone has Word on their PC, and could thus help me with such an example).

What I REALLY want is (ultimately) PageMaker.  But for now, I'm looking for an example in Word (or WordPad, whatever).

And they key point is the LOOPING through all files in a directory.

Anyone?

Link to comment
Share on other sites

  • Moderators

@PaulRahoi, for the looping look at _FileListToArray, or _FileListToArrayRec (depending on your needs for a recursive search) in the help file. The examples should speak directly to what you're trying to do.

Edited by JLogan3o13

"Profanity is the last vestige of the feeble mind. For the man who cannot express himself forcibly through intellect must do so through shock and awe" - Spencer W. Kimball

How to get your question answered on this forum!

Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
 Share

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...