Skip to main content
Version: 8.1

btxml.newScript

Creates a new BTXMLScript object. Can contain multiple script commands.

Syntax

system.bartender.btxml.newScript(version, id, name, commands)

Parameters

TypeParameterDescription
StringversionXML script version. Default "2.0"
Stringidunique identification number to identify the XML script request
Stringnamename to identify the XML script request
List<Command>commandsa 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>