Deserialization of the gateway scripts

Don't suppose Kindling or similar software has the ability to deserialize ignition 8.1 gateway scripts from their bin form, or at least convert them to an XML in the same way as vision XMLs? (I'm looking to be able to read them out of a backup file)

XY problem solving -- is there a way to programmatically update gateway scripts/project library scripts in 8.1?

Yes, you can edit library scripts outside of ignition, you just need to be aware of the file structure. Script files should be open-able with any text editor or IDE

Does this work with vision and gateway event scripts as well?

It should, as its all defined and stored in the project files. I don't know if they are all accessible from the designer device, as they all live on the gateway device/filesystem.

Hmm, this repo doesn't look like it handles the serdes of the relevant .bin files...

I vaguely remember there being a setting to have the resources saved as human readable instead of binary files. I can only find a setting for Vision windows in the docs, someone who is more familiar about editing resources outside of Ignition will have to chime in here.

Yeah, I know that exists for vision windows, but I can't find it for other resources

It does not exist for the event scripts resources. Those are java serialized and basically can only be opened in the intended places within Ignition.

In general, if the file ends in .bin, it is not human readable or manipulable outside Ignition. Full stop.

(Fixing all these is a major goal of v8.3.)

3 Likes

Thanks!

Followup q -- is there a major difference between the execution context of a project script called in a oneline gateway event script, and a gateway event script containing the code that would have been in that project script?

i.e. between
Gateway:

def event(*args, **kwargs):
     project(*args, **kwargs)

Project library:

def project(arg1, arg2, arg3):
     #CODE GOES HERE

And

Gateway:

def event(*args, **kwargs):
     #CODE GOES HERE

Yes. Code placed directly in the gateway event script's code window will run in Python v2.1 legacy mode, which largely breaks any def nested within. (Also fixed in v8.3.)

You will find my advice all over this forum strongly recommending the use of one-line calls into the project library in ALL Ignition events. This is one of the reasons.

Basically, if you are using def or class or import anywhere outside the project library, you are screwing up.

2 Likes

Great, that was going to be my plan anyway, since I do know enough about project serdes to handle event script generation for oneliners in those bin files

1 Like

I don’t know all the ins and outs, but there are legacy scoping issues that occur when writing the scripts directly in gateway events.

There are other reasons to favor project scripts, but that is the major one I’m aware of.

1 Like