PDF Drop Box?

I'm trying to set up a folder as a drop box for Word documents to be automatically converted into pdf files. The approach I'm taking is outlined below, but I'm failing at the stage of scripting Word to Save As PDF.
  1. Use Folder Actions to open a script whenever a file is dropped on the Drop Box
  2. Check that the file has a doc extension
  3. Open the file in Word
  4. Bring up the Print dialog, using Word’s built in scripting
  5. Click the Save As PDF button, using the UI Scripting beta
  6. Create the destination folder if it doesn’t already exist
  7. Save to the destination folder

Steps 1-4 are fine. At step 5, I run into a problem in that the UI Inspector can’t identify the name of the parent container (?) of the Save As PDF button, so I can’t refer to it. At least I think that’s what is happening.

Here’s a piece of test code I’m trying to get working.

on run
	tell application "Microsoft Word"
		set this_file to (choose file with prompt "Select file to be converted to PDF format")
		print this_file
	end tell
	delay 2
	tell application "System Events"
		tell process "Microsoft Word"
			tell window "Print"
				-- Need a tell reference to the bottom part of the Print Window
					tell button "Save As PDF…"
						click
					end tell
				-- end tell for bottom of Print window
			end tell
		end tell
	end tell
end run

Any suggestions? Am I missing something obvious (like a Save As PDF scripting command in Word)?

Thanks in advance,
John
</newbie alert>

I’d like to do the same from many app but I don’t know how to tell ‘save as pdf command’
let me know if you succeed
Thanks

John

This is similiar to my issue in that printing to pdf via applescript seems to be impossible, that is no one so far can assist.

That is until I discovered Pagesender 3.0x which is a Fax software package for OSX (if you are using OS9, then you can use print to pdf a shareware printer driver. (check versiontracker.com for this).

Here is the advertising blurb for Pagesender regarding scripting. Hope this helps
www.smilesoftware.com

Three example scripts and one FileMaker Pro database are included with Page Sender. They are found in:
/Library/Printers/Page Sender/AppleScript Examples.

E-mail from Script Example - Demonstrates using Page Sender to automate E-mailing PDFs of whatever you can print. Note that you can set the subject and content using the email info class, and you can even set the recipient type of the email recipient if you’d like to add CC or BCC recipients.

Fax from Script Example - Demonstrates using Page Sender to automate faxing whatever you can print. Note that you can set multiple cover pages, and you can add additional replacements to your custom cover pages.

Prefill Envelope Example - Demonstrates using Page Sender to pre-fill the print dialog. Perhaps you wish to pre-fill the print dialog as a convenience yet allow the user to change things before sending. This shows you how.

FileMaker Pro Example - We’re just casual FileMaker Pro users here at Smile Software, but we thought it would be useful to put together a basic scripting demo. The purpose of the example is to give an idea of how one might use Page Sender to automate the E-mailing or faxing of invoices from a database. There are two layouts - Data Entry and Invoice, and there are two scripts - Fax Invoices and Email Invoices. The basic idea of the script is to find each data entry record individually, write a customized AppleScript to the global Script field, execute the script, print the invoice (thereby E-mailing or faxing it via Page Sender), wait a moment for the print job to flow through the queue and repeat. This example was produced and tested in FileMaker Pro 5.5 and may not work with earlier versions of FileMaker Pro.Scripting experts - please feel free to send feedback.

Scripting Caveats

Here are some things to watch out for when scripting Page Sender:

The application name property of the preset must be set to whatever that application uses as the title of its applications menu. For example, the application name of Microsoft Word is “Word”.

Only one preset per application may be in effect at one time; if you save another preset for the same application, it will overwrite the previous one.

One preset may contain only one address type - email or fax, not both, though it may contain many addresses of that type.

Presets are ephemeral - they “live” only for one print job, whether that job is automated via AppleScript or run by the user. You will have to write a new preset for each print job.

Presets are stored in ?/Library/Page Sender/Presets. Do not try to write your own preset files, as we may change the file format in the future. You may, however, remove a preset file (as you might wish to do if the user aborts your script).