How to multi-threading on ScriptWorX2006/2010

You can use multi-thread on ScriptWorX 2006 or 2010 to run each script. This article will show the example to writing value to OPC tags separately by using each designer and script.


– Create each designer for each script. This will make all script free from each other as multi-threading.

– Use trigger to control each script.


Create script

Open ScriptWorX 2006 from Start > Programs > ICONICS GENESIS32 > ScriptWorX32 > ScriptWorX 2006 or 2010. In this example, I add new designer “opcwrite1” into existing project. You can also creating new project. And create new script “opcwrite” into designer. As figure below, I use trigger “Every Sec” to control script. You can browse or create a new trigger as well.



Click Apply and  Edit VBA Code.

In VBA editor, select Tool > Reference. Then choose GenClientWrapper using for read/write OPC tag.


click OK.

At sub opcwrite, enter script to send random value to OPC tags FLOAT1, FLOAT2, FLOAT3, FLOAT4 by for loop as shown. Those opc tags are in ICONICS OPC Simulator.



Now get back to create new Designer on ScriptWorX2006 / 2010 again for another thread.

Right-click on project, select  New > Designer/Thread.




Name new designer as  opcwrite2. then Apply.




Create new  Script “opcwrite2” into new designer.  Then apply same trigger. Click Apply and Edit VBA code.



Writing code to send random values to more opc tags, FLOAT5 toFLOAT8.




Save and get back to configuration.

Start runtime. 




Monitor all opc tags using GraphWorX or OPC DataSpy.




By this way, ScriptWorX will working in Multi-Thread.

This entry was posted in Tips. Bookmark the permalink.

Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out /  Change )

Google photo

You are commenting using your Google account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s