Bladed Knowledge Base

How to add encrypted project files into Batch by Bladed project API
Category: API

Problem
It will fail when using Bladed project API to add an encrypted project into Batch.
How to solve the issue?
Versions of Bladed affected: Bladed 4.9 onwards
Date article last updated: 18 Aug 2023

Solution

First, turn on this option in the beginning of the API script: Bladed.ProjectApi.Settings.SuppressEncryptionException = True

Then, the API falsely expects a "PASSWORD" keyword in the ".prj" file. It expects to see this after the "NOTES" keyword.

(1) Example 1: if there is no "Project Info" data defined in the encrypted project, take the demo_a model as an example(see the following figure). Please note there is a "Tab" after the keyword "PASSWORD"

(2) Example 2: if there is "Project Info" data defined in the encrypted project, take the FloatingDemo model as an example(see the following figure). In the .PRJ file, the keyword "PASSWORD" is added after the line "NOTES".

But the "Project Info" data has been removed. Users can add the "Project Info" back through the API. Please see the example code here.





Keywords Project API; Encryption