xAP Language Extensions

The xAP class provides xAP-specific extensions to VBScript, and can be used from any of your scripts when running under xPLHal.
The section parameters refer to a zero-based index, where 0=header, 1=1st body section and so on.
The following xAP-specific functions are currently available:

To return the number of bodies in a xAP message

bodycount = xap.BodyCount(xapmsg)
This returns the number of body sections, not including the header.

To retrieve a named value from a xAP message

Myvar = xap.GetParam(xapmsg,section,param)
This returns the value of the given param name from the specified section.

To retrieve the number of name/value pairs from a particular section of a xAP message

Myvar = xap.GetParamCount(xapmsg,section)
This returns the number of name/value pairs in the section.

To retrieve a parameter name by index from a xAP message

Myvar = xap.GetParamName(xapmsg,section,index)
This returns the name of the parameter by it's index in the specified section. Use the GetParamCount function to determine the number of values in a section.

To retrieve a parameter value by index from a xAP message

Myvar = xap.GetParamValue(xapmsg,section,index)
This returns the value of the parameter by it's index in the specified section. Use the GetParamCount function to determine the number of values in a section.

To retrieve the name of a body section

Myvar = xap.GetSection(xapmsg,section)
This returns the name of the specified section.

To send a xAP message

Call xap.SendMsg(uid, class, source, target, bodies)
XPLHal builds the full xAP header from the supplied parameters.
If the target parameter is an empty string (""), the target= element will be omitted from the header.
The bodies parameter must contain all required delimiters such as { and }.