New tool BrPyZip

Since Automation Studio is struggling to save large projects with all updates as ZIP files, I created a python script that will gather all updates from a project and store them in a ZIP file. It also provides more options what to save and what to exclude. You can find the tool and some description on GitHub. This is the first version, so let me know if you find any issues or have any comments.

14 Likes

Some screenshots from my test based on documentation:

  1. I downloaded the executable and config file from the source code and copied them to a local folder with tools - first release

  1. Started the executable and selected the project to ZIP.

  1. Selected ZIP options according to my requirements and executed the ZIP command.

  1. Results: one ZIP file with the project and another one with upgrades.

Content of ZIP files:

Conclusion:

  • Easy to use
  • Fast

Thanks @stephan.stricker :clap:

Note: I would be happy if, at the end of the ZIPPING process, the explorer would open with the ZIP files, so I can copy and paste them without browsing to the destination path :slight_smile:

2 Likes

@kovarj Thx for the feedback. New version 1.1 is up with this addition and a new option to run the app with the Windows Explorer context menu. See the documentation on how to make this work.

BrPyZip Documentation

Changes in version 1.1

  • Open directory containing the ZIP file

  • Allow project path as start parameter

  • Add option to create Windows Explorer context menu entry

  • Minor improvements and bug fixes

3 Likes

Thank you for the tool.
I tried to zip different projects as a Test and it always failed.
The reason is, that in our projects from old times the Folder “PLC1\ExternalHardware” exists, but the folder ist empty.
The package.pkg looks like this, AS is happy with it:

<?xml version="1.0" encoding="utf-8"?>
<?AutomationStudio FileVersion="4.9"?>
<Package xmlns="http://br-automation.co.at/AS/Package">
  <Objects />
</Package>

The tool spits out this error:

> Failed to open file ‘C:/projects/ZipTest/Fran_31902_b/Physical\SCA_KlassischEasy_Use_1x3\PLC1//ExternalHardware/ExternalHardwareDevices.xml’: [Errno 2] No such file or directory: ‘C:/projects/ZipTest/Fran_31902_b/Physical\SCA_KlassischEasy_Use_1x3\PLC1//ExternalHardware/ExternalHardwareDevices.xml’

In file_handler.py in line 140 the tool checks if the folder exists and expects that the file “ExternalHardwareDevice.xml” also exists:

if os.path.exists(folder_path_ext + "/ExternalHardware"):
...
content = open_file(folder_path_ext + "/" + "/ExternalHardware/ExternalHardwareDevices.xml", hmi_instance)

Hi Björn,
thx for reporting this issue. I created a new version that accounts for the missing file. Please give it a try.

Release Version 1.2 · br-automation-com/BrPyZip

2 Likes

Hi Stephan,
Thank you very much for your fast reply and the fix.
The first test zipped the projects just fine.

2 Likes

There is a new version 1.3 with the following changes

  • Fixed error message when no technology packages are used
  • Account for missing hardware files in the project

Release Version 1.3 · br-automation-com/BrPyZip

There is a new version 1.4 with the following changes

  • Fixed mappService are not included

Release Version 1.4 · br-automation-com/BrPyZip

1 Like

Thanks @Stephan, small note I still see version 1.3 on the latest one:

and now I see mappService incuded in the Updates.zip file:

Thx for the hint. I corrected the version information and updated the release.

2 Likes

New Version 1.5 is up with support for headless mode

  • New headless mode without UI
  • Code cleanup and minor improvements

Download from here Release Version 1.5 · br-automation-com/BrPyZip
Documentation for headless mode is here Appendix - BrPyZip

2 Likes

Good Tool… Love it… :grinning_face:

Hi all,
Script is running & able to generate .zip files.
AS project zip successfully. but upgrade file has no content in it.

Can you please post the log file as text

logFile.zip (2.5 KB)
Text is too long to post , please find .zip

Hi,
Issue solved,
Today i have uninstalled AS 4.12.5.95 SP and install AS 4.12.7.113 SP
During uninstallation all Mapp upgrade file were deleted. so it is not generating upgrade file in .zip.

One query → does it include hardware upgrade in .zip apart from Mapp upgrade.

Yes, it should include all hardware files including DTM devices but the upgrades must exist in ex. C:\Program Files\BRAutomation4\AS412\AS\Hardware\Modules

Thank You @stephan.stricker, Working !

New version 1.6 is out with the following changes

  • Project path does not have to be APJ file, but can be just the project directory
  • Updated registry file to add BrPyZip option on folder right click
  • Added more wildcard PLCs to config
  • Fixed config file was written to wrong directory
  • Fixed runtime is not always included

Make sure to update registry settings to use right click on the project directory to zip the project.

[HKEY_CLASSES_ROOT\directory\shell\BrPyZip]

@="BrPyZip"

"Icon"="\"C:\\Users\\YourUserName\\Documents\\BrPyZip\\BrPyZip.exe\",0"

[HKEY_CLASSES_ROOT\directory\shell\BrPyZip\command]

@="\"C:\\Users\\YourUserName\\Documents\\BrPyZip\\BrPyZip.exe\" \"%1\""