View Single Post
You can get the file name from the shell process which loops through the .003 files.

If you can make sure that all documents in oo3 are closed, you can then assume that the newly opened one is the front document.

Don't have time for testing or debugging today, but you should be able to put something along these general lines in a shell script:

Code:
osascript -e 'tell application id "OOut" to close documents' > /dev/null 2>&1;
for f in *.oo3 
do 
	open "$f"
	sleep .5 # You may be able to reduce or remove this
	osascript -e 'tell application id "OOut" to export front document as "OORTFPboardType" to "~/tmp.rtf"' > /dev/null 2>&1;
	/System/Library/Printers/Libraries/convert -f  ~/tmp.rtf -o "$f".pdf > /dev/null 2>&1;
	osascript -e 'tell application id "OOut" to close documents' > /dev/null 2>&1;
done
rm ~/tmp.rtf

Last edited by RobTrew; 2011-08-31 at 03:39 AM..