A cool feature of InduSoft Web Studio is its import wizard that lets the user import files made in other software into the InduSoft Web Studio HMI project, facilitating cross platform compatibility. A very useful tool added to the Import Wizard is the Studio XML Screen which lets the user import XML screen code file into InduSoft Web Studio as a .scr screen file. This is a neat functionality to import pre-programmed XML screens into InduSoft or manipulate other InduSoft features with this tool to make screens on the fly by generating XML code.
How to create an XML screen in the InduSoft framework:
1. Open the Indusoft Product folder. In the Bin folder there should be a folder called Schemas and it has a file called screen.xsd. This is the XML framework for creating screen code compatible with Indusoft.Open an XML editor like Microsoft Visual Studio and open a screen file like the sample file the Objects.xml and enable the view for Document Outline. In the properties of the XML file under this menu : browse the Screen.xsd file as the Schema from the Step 1 and add as a Schema.
2. This now exposes several options for properties of different objects. The Objects.xml contains several objects whose parameters can be changed appropriately in the XML editor. The structure of an XML screen document has 3 main sections: VBScript, Attributes and Object List. The VBScript section is header for the screen document and Attributes section defines properties in XML format that is used under the InduSoft menu Graphics->Attributes. The object List section defines all the objects and their properties on the XML script which is similar to the user drawing these objects on the screen in InduSoft Web Studio using the Graphics ribbon.
How to import the XML screen file to InduSoft Web Studio
1. Open the Import Wizard from the Home Ribbon menu and select Studio XML screen.
2. Select the appropriate option for importing a duplicate screen if required and Browse the XML file and click Next
3. Select which tags to import to the InduSoft database.
4. InduSoft tree view on the left side will perform a small refresh and you should see a Screen file added to the project with the same name as the .xml file.
What happens on importing the Screen?
A screen file is created in the <App folder>\Screen folder with the extension .scr This can be opened in the Engineering environment from the Graphics Tree View-> Screens or in the runtime by enabling the Menu option for Viewer and then opening the File menu and then finding the newly created screen by browsing the file from the <App folder>\Screen folder.
Import XML Screen Function:
InduSoft Web Studio additionally has an ImportXML function which imports XML files into the application. Currently this function can only be called from the engineering environment not the runtime environment. This function can be called in a script or procedure and this way the user can import a screen into the <App folder> \Screen folder.
The syntax for this function is :
ImportXML( strXMLFile, optStrDestFile, optNumFileType, optNumReplaceDuplicate )
A helpful example of this function call can be:
In this function:
Objects.xml : Name of the XML Screen file created.
$GetAppPath()+”Screen\” : Is the first part of the destination of the file to be created which is the application folder’s screen folder.
+$ScreenName+”.scr”: The addition symbol appends the above address with the name of the .scr file that will be created on import. This way the user can define the name of the .scr file created with the tag $ScreenName.
0: This is a numeric flag indicating that it is a Screen Studio XML file. Currently InduSoft doesn’t support any other files of the type Studio XML.
1: Is the parameter passed to select replace duplicate project file (if there is a screen file with the same name in the project) with the new file. Alternately the user can use 0 to not a import duplicate file into the Screen folder.
More information about this function can be found in the Help ribbon menu -> Help
Use the Report task to create XML files on the fly when it takes appropriate dynamic tag values to create objects on the screens. See the application for a graphic user interface with some default values for objects which uses Report function to create the XML files.
Have fun using InduSoft Web Studio and XML!