Have you ever wanted to create a new configuration in Automation Studio which is mostly made of reference files, only to find yourself spending a lot of time creating new files and folders one-at-a-time in order to duplicate the existing configuration? I definitely have, and so I’ve been working on a Python script to automate that process.
Place the AsConfigDuplicator python script in the folder which also contains the AS project folder
Run the script using Python >= 3.9.2
Input the AS project name (the name of the project folder which holds the .apj file)
Input the name of the configuration to be duplicated
Input the name of the new configuration
After that, you’ll have an exact copy of your initial configuration except that all of the files in the Configuration View will not be copies, but instead references to the initial configuration. From there you can swap out the hardware if desired.
This is something that I’ve finished recently so I haven’t tested it on many projects yet. If you do try this out, please let me know if you run into any issues or have any other feedback. The script is open source so feel free to adapt it to your own needs as well.
Disclaimer: Before you run an automated script on your project files, make sure the project is backed up or committed to a version control system in order to avoid any unintended consequences.
Another thing that may not be often known about is that you can actually define reference packages in Automation Studio projects. This can be a huge benefit for example if you’ve made a copy of a configuration and you want to say, reference the entire MpView package of your main configuration. To do this, you can manually edit the Cpu.pkg file and simply add the
Reference=“true”
attribute to the package in question along with the path to the folder in question.
For example:
Modifying the mappView entry in the Cpu.pkg file from:
This makes it very handy so that when you add a new file to your main configuration, you don’t need to go through and update the rest of your configurations by adding new referenced files.
edit: As mentioned later on in this thread - be careful in editing these files externally to Automation Studio. This is definitely an undocumented functionality. In general I’ve seen no adverse side effects however that doesn’t mean I’ve tested all possible combinations. I’d recommend to use git/source control to have backups and test thoroughly.
An alternative to using AS configurations would probably to use e.g. git branches. Then you wouldn’t have to care about what Automation Studio supports and what not. But that’s just a thought…
Not exactly the same, if you use the reference to package when you add a file inside the original configuration this file is automatically also available inside the copied configuration, this is nice in particular for mappview