Create a modified version of ScriptPro 2.0 (one of our Plugins of the Month) to call our command without opening the drawing

The broader point of today’s post – other than simply to deliver on step 4, above – is to demonstrate that there are definitely simple options when it comes to architecting and building your own batch-processing tool. It’s quite possible that ScriptPro 2.0 does what you want, out of the box, but in our case it does not: we do not want to load a drawing into the AutoCAD editor to process it, we want to run a custom command to load drawings in side databases in order to process them more quickly.

But as the full source code for ScriptPro 2.0 is available on Autodesk Labs, it’s a simple matter of editing it for our own purposes. I won’t go into great detail on the changes that were needed – most of which were cosmetic in nature – but I will list a few areas:

Changed the name of the application from ScriptPro 2.0 to RegAppReport

Stripped down the UI of the main dialog

Reduced unwanted items from the ribbon (load SCP, for instance)

Removed the script selection box and associated code

I didn’t bother changing the options dialog, at all, but I did change the load/save of the drawing lists not to include that information

Removed the code to open the selected document in the AutoCAD editor

Customized the code to call our XRA command – rather than SCRIPT – passing in the DWG we want to process via the command-line

Added some code to copy the file placed at C:\RegAppData.xml to the executable location, where our XSLT resides

I also decided to back up the previous contents of this file, in case they were needed

We could also have specified the XML as an argument to the command, but felt it less disruptive (in terms of changes to the previous implementation) to do it this way

We give the option of automatically launching the XML report (rendered to HTML, of course) after processing