Posted by: Xjlittle
autoit, automate, centos, gui, Linux, Lotus Domino, Microsoft Windows, microsoft work, Open Office, openoffice, pscp, putty, scp, script, scripting, word
I ran into a situation a couple of weeks ago where it would be convenient to script Word and OpenOffice documents into pdf format. One of my jobs here is to create the network and email login documentation for newly hired people. I have the document creation automated through an AutoIT script. I previously posted about AutoIT here.
The next step after creating the Word document is to copy it to my Linux workstation where my Lotus Notes client resides. Once there I want to convert it to pdf and attach it to an email for sending to the new hire’s manager.
I copy the newly created Word document using Putty’s pscp application. This script is called from the AutoIT script that creates the documents. The pscp script is written as follows:
pscp -pw mypassword -r c:\userdocs jslittl@centos5-xvm:/home/jslittl/Documents/Notes-Domino/users2convert
You can place this script at the end of your AutoIT script so that it copies your document to wherever you want. So this is where I am in the process: AutoIT script to create the document => scp the document to my Linux workstation.
I followed the instructions here to setup OpenOffice for scripting the documents to pdf. My script to do so is setup like this:
[jslittl@centos5-xvm userdocs]$ cat convertDir2PDF.sh
for i in *.doc; do echo $i; doc2pdf "$i"; sleep 5; done #this will convert all documents in the directory
# zip newusers *.pdf # this is for when there are a large number documents going to the same place-easier to attach 1 zip file
mv *.doc `pwd`/finished-doc # I created the next 3 directories to hold the finished documents
mv *.pdf `pwd`/finished-pdf
mv *.zip `pwd`/finished
That’s it! Just attach them to the email and send them on.