2

I have a lot of repetitive tasks to perform such as:

  1. Open a .dwg file and print it out as a .pdf

  2. Open a .docx or .xlsx file and print it out as a .pdf

Now, as far as .docx and .xlsx formats are concerned, most pdf converters can handle conversion to pdf of many files at once, however the .dwg files (Autocad files) need to be opened in autocad and then be printed through the typical ctrl+p process.

I've improved the process using a script written in Python that at the very least automates the process in what I call a naive way: due to the nature of the steps it takes, there are at least two big problems

  1. it takes 20-30s for each file to be printed. That is a very long time and it adds up when you have 500+ files to process.

  2. The PC cannot be used for anything else when running the script

I'm not sure it is worth it spending time looking up through various APIs to improve the code therefore I would like to know if there exists a program to automate such repetitive tasks.

I am looking for a software that can automate the printing of the .dwg files and ideally it should also be able to run in the background.

  • Not sure if it is a good option, hence the comment not an answer, but one way to run in the background so to speak is to run the entire script in a virtual pc – holroy Sep 11 '15 at 11:25
  • Have you given any thought to running the script as a scheduled task at a time when the system is not used? You might also consider using something like Jenkins to schedule and automate repetitive tasks. – rrirower Sep 11 '15 at 13:24
  • 1
    How does your Python script work? We could potentially give better advice if we know what currently doesn't work. Have you had a look at AutoCAD's command line parameters or related tools, which might simply print the file without starting a GUI (= taking more computing power)? – ComFreek Sep 11 '15 at 17:32
  • @rrirower I did not know about Jenkins, that might be ok for the automating process! – mickkk Sep 11 '15 at 19:20
  • @ComFreek The python script essentially simulates the user pressing the keyboard, then it checks whether the file has been printed and exists in the output directory, if not loops through the open file + ctrl + p + enter process again until it works (this is a "security feature" although it is rarely triggered). It is kind of a rough automation I know, but so far it saved me A LOT of typing. Problem is, it is very slow mostly because the Autocad GUI is slow and Python needs to wait some seconds (0.5,1 or 1.2) after every command! Do not know if I can post the script here. – mickkk Sep 11 '15 at 19:27
2

I have not worked that much in this area but you can try VeryPDF which provides command line tools to convert the files to pdf.

Once you have this tool installed, you can simply write a batch file (DOS batch file) which loops through required .dwg file and prints to PDF.

After you have created this batch file (.bat file), add it to Windows task scheduler at appropriate date time. As this is batch file, you can configure it to run in background with minimal CPU resource through programming only.

Yes. It requires little bit of work from your end but it should fulfill the requirement you have stated.

  • Thanks for the suggestion, I emailed their support staff and explained my problem. Will update as soon as they reply. – mickkk Sep 11 '15 at 19:35
  • Their command line executable is just what I needed to automate the task – mickkk Sep 16 '15 at 10:16
  • glad to hear that it helped. – atp9 Sep 16 '15 at 10:34

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.