btxml.newScript
Creates a new BTXMLScript object. Can contain multiple script commands.
Syntax
system.bartender.btxml.newScript(version, id, name, commands)
Parameters
Type | Parameter | Description |
---|---|---|
String | version | XML script version. Default "2.0" |
String | id | unique identification number to identify the XML script request |
String | name | name to identify the XML script request |
List<Command> | commands | a list of commands to run |
Returns
BTXMLScript - Parsed result.
Scope
Gateway, Designer, Client, Perspective Session
Example
Parse a BTXML script from a JSON string.
config = """{
"version": "2.0",
"commands": [
{
"type": "Print",
"actions": [{
"type": "Print",
"jobName": "Print Item Label",
"format": {
"documentPath": "C:/Path/To/File.btw"
},
"printSetup": {
"printer": "MyLabelPrinter"
},
"namedSubStrings": [
{
"name": "name",
"value": "Item Name"
},
{
"name": "quantity",
"value": "500"
}
]
}]
}
]
}"""
script = system.bartender.btxml.fromJSON(config)
print script.toBTXML()
Result
<XMLScript Version="2.0">
<Command Name="">
<Print JobName="Print Item Label">
<Format>C:/Path/To/File.btw</Format>
<NamedSubString Name="name">
<Value>Item Name</Value>
</NamedSubString>
<NamedSubString Name="quantity">
<Value>500</Value>
</NamedSubString>
<PrintSetup>
<Printer>MyLabelPrinter</Printer>
</PrintSetup>
</Print>
</Command>
</XMLScript>