It’s time to wrap up the series on batch-reporting Registered Application IDs. For reference, here’s how we got to where we are today:
- Implement a command to collect RegAppId information for the active document
- Extend this command to work on a drawing not loaded in the editor
- Save our RegAppId information to some persistent location (XML)
- 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
It should be noted that the code developed in the previous posts, defining the XRA command, should be built into a plugin and set up to load automatically into AutoCAD at startup or when the XRA command is called (you can, of course, set this up programmatically).
Here’s the application in action…
And finally the results…
It’s altogether possible to extend this application to actually – even selectively – purge RegAppIds from drawings, but that’s being left as an exercise for the reader.