# Programmatic project script library updates

**URL:** <https://forum.inductiveautomation.com/t/programmatic-project-script-library-updates/2935>\
**Category:** Module Development\
**Created:** [May 12, 2011, 5:43am UTC](https://forum.inductiveautomation.com/t/programmatic-project-script-library-updates/2935 "2011-05-12T05:43:11Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![cgz](https://avatars.discourse-cdn.com/v4/letter/c/8dc957/32.png) [@cgz](https://forum.inductiveautomation.com/u/cgz)\
**Post date:** [May 12, 2011, 5:43am UTC](https://forum.inductiveautomation.com/t/programmatic-project-script-library-updates/2935/1 "2011-05-12T05:43:11Z")

</div>

Hello!

Is there anything I could do to programmatically update project’s script library?

It’d be used in a module build script to automatically re-generate any java-to-python bindings for  
the module and it would reduce significant amount of manual work.

Thanks!

---

<div class="post-metadata">

**Author:** ![Kevin.McClusky](https://avatars.discourse-cdn.com/v4/letter/k/47e85d/32.png) [@Kevin.McClusky](https://forum.inductiveautomation.com/u/Kevin.McClusky)\
**Post date:** [May 19, 2011, 9:57pm UTC](https://forum.inductiveautomation.com/t/programmatic-project-script-library-updates/2935/2 "2011-05-19T21:57:17Z")

</div>

I guess refer to my other post 🙂

I’d guess you could do something like this:

1. Grab all projects
2. For each grab the ScriptLibrary object
3. Modify it
4. Serialize it, and update the ProjectResource to include it.

I threw together some pseudocode to do this.

[code] for (Project project : context.getProjectManager().getProjectsFull(ProjectVersion.Staging)) {  
for (ProjectResource resource : project.getResourcesOfType("", “sr.script.library”)) {  
// Grab the scriptLibraries  
List scriptLibraries = new ArrayList();  
for (Object o : context.createDeserializer().deserialize(resource.getData()).getRootObjects()) {  
if (o instanceof ScriptLibrary) {  
scriptLibraries.add((ScriptLibrary) o);  
}  
}  
// TODO: Modification code

```
			// Re-serialize them, and add them back to the project
		}
	}[/code]

```

I don’t know if the ProjectResource actually has more than one ScriptLibrary living in it.

It appears the GatewayContext doesnt have a context.createSerializer() though.

IA guys, is there any way to serialize from the gateway?

---

<div class="post-metadata">

**Author:** ![Carl.Gould](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/carl.gould/32/7262_2.png) [@Carl.Gould](https://forum.inductiveautomation.com/u/Carl.Gould)\
**Post date:** [July 21, 2011, 9:57pm UTC](https://forum.inductiveautomation.com/t/programmatic-project-script-library-updates/2935/3 "2011-07-21T21:57:01Z")

</div>

Not currently. Sounds like he wanted to do it as part of the build though? I’m not sure what bindings exactly are being re-created here…
