# Script Creation of windows

**URL:** <https://forum.inductiveautomation.com/t/script-creation-of-windows/10477>\
**Category:** Ignition\
**Created:** [September 16, 2015, 3:48pm UTC](https://forum.inductiveautomation.com/t/script-creation-of-windows/10477 "2015-09-16T15:48:04Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![Amarth](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/amarth/32/3313_2.png) [@Amarth](https://forum.inductiveautomation.com/u/Amarth)\
**Post date:** [September 16, 2015, 3:48pm UTC](https://forum.inductiveautomation.com/t/script-creation-of-windows/10477/1 "2015-09-16T15:48:04Z")

</div>

Hello all,

I have a project to migrate an old scada system to Ignition. The idea is to export the old scada views and variables in a database then create the new project in Ignition.

Let us assume that the database is correctly filled with all needed information.

I can create tags from variables list by using system.tag.addTag(). I can also instanciate templates in an existing window by using com.inductiveautomation.factorypmi.application.components.template

Problem : I am not able to create a new Window in a project. I had a look in the Programmer’s Guide (Chapter 4) and figured that I needed to create a project Resource.  
Here is an extract from my code :

```auto
from com.inductiveautomation.ignition.common.project import ProjectResource

context = getContext(event)
newResourceId = context.getLockManager().newResourceId()
windowByte = event.source.parent.getComponent('Table').data.getValueAt(0,"CONTENT")

try:
	dataNewWindow = ProjectResource(newResourceId, 'fpmi', 'window', 'WindowTEST',4,windowByte)
	context.updateResource(dataNewWindow)
except Exception, err:
	print "ERROR", str(err)
	context.getLockManager().releaseLock(newResourceId)
```

the getContext function is defined [here](https://inductiveautomation.com/forum/viewtopic.php?p=41502#p41502). Thank you Nick for sharing.

Now I’m stuck with the last argument of ProjectResource(). I can not figure what to set this argument to. I have tried so far:  
[ul]  
[li] String containing pasted code of a designer copied window[/li]  
[li] String from a BLOB in a database containing different part of the previous string (from all to only CDATA content)[/li]  
[li] Byte Array from a dataSet containing the previous BLOB.[/li]  
[li] Empty array[/li][/ul]

My question is : What does the ProjectResource constructor expect for its byte[] data argument?

Thanks in advance for the help.

Regards.
