runset object
The VWorks JavaScript interpreter provides a runset object that can be accessed by a script. runset enables control of the Runset Manager through JavaScript. You can use the runset object to clear the runs from a runset or append protocols to a runset. You can also query the Runset Manager and retrieve various fields of interest, such as barcodes. For more information on runsets, see Managing runsets.
Note: If you are using the VWorks Watcher, the runset object can be used in a script that is called by Watcher to create runsets automatically. For details, see Setting up and using the Watcher tool.
Properties
The runset object has no properties.
Methods
Methods are JavaScript functions invoked through an object. The runset object has the following methods.
 
Method
Description
clear()
Clears all of the entries in the runset manager, except for currently executing protocols, which are not affected.
Example:
runset.clear()
appendProtocolFileToRunset(string ProtocolPath, int RunTimes, string ProtocolNotes, string formToUse)
Appends the specified protocol file at ProtocolPath to the Runset Manager. Specifies the number of RunTimes, and provides any ProtocolNotes.
To specify a VWorks form to be associated with the protocol, formToUse must specify the file name of the form without the path, for example, C:\MyDir\MyForm.VWForm must be specified as "MyForm.VWForm".
Returns true if successful or false upon failure. If a failure occurs, for example, the .pro file is missing, errors are written to the log.
Example:
runset.appendProtocolFileToRunset("[olssvr]:VWorks Projects/VWorks/Protocols/General/someprotocol.pro",10, "","FormName1.VWForm");
appendProtocolFileToRunsetAtTime(string ProtocolPath, int RunTimes, string ProtocolNotes, string formToUse, string AtTime)
Appends the specified protocol file at ProtocolPath to the Runset Manager at the date and time (local time) specified by AtTime. Specifies the number of RunTimes, provides any ProtocolNotes that will appear in the Runset Manager pane.
To specify a VWorks form to be associated with the protocol, formToUse must specify the file name of the form without the path, for example, C:\MyDir\MyForm.VWForm must be specified as "MyForm.VWForm".
Returns true if successful or false upon failure. If a failure occurs, for example, the protocol file (.pro) is missing, errors are written to the log.
Example:
var d = new Date();
ProtocolStartTime = d.toString();
runset.appendProtocolFileToRunsetAtTime("[olssvr]:VWorks Projects/VWorks/Protocols/General/Protocol File - 1.pro",10,"","FormName1.VWForm",ProtocolStartTime);
appendRunsetFileToRunset (string runsetPath, string formToUse)
Appends the contents of a runset file, located at runsetPath, to the Runset Manager.
To specify a VWorks form to be associated with the protocol, formToUse must specify the file name of the form without the path, for example, C:\MyDir\MyForm.VWForm must be specified as "MyForm.VWForm".
Returns true if successful or false upon failure. If a failure occurs, for example, the .rst file is missing, errors are written to the log.
Examples:
runset.appendRunsetFileToRunset("[olssvr]:VWorks Projects/VWorks/Runsets/General/runset.rst");
runset.appendRunsetFileToRunset("[olssvr]:VWorks Projects/VWorks/Runsets/General/runset.rst", "FormName1.VWForm");
openRunsetFile(string runsetPath, string formToUse)
Opens the runset located at runsetPath.
Optionally, opens the form to use to run the runsetformToUse must specify the file name of the form without the path, for example, C:\MyDir\MyForm.VWForm must be specified as "MyForm.VWForm".
Returns true if successful or false upon failure. If a failure occurs, for example, the .rst file is missing, errors are written to the log.
Examples:
runset.openRunsetFile("[olssvr]:VWorks Projects/VWorks/Runsets/General/my_runset.rst");
runset.openRunsetFile("[olssvr]:VWorks Projects/VWorks/Runsets/General/my_runset.rst", "FormName1.VWForm");
getRunsetXML()
Returns the XML contents of a runset file (.rst).
Example for getRunsetXML()
// Note: In this example, runsetParser is a hypothetical JavaScript function.
var runsetXML = runset.getRunsetXML()
var runsetParser = new runsetParser(runsetXML)
var numRunningProtocols = runsetParser.GetNumberOfRunningProtocols()
 
for(  var running_protocol_idx = 0;
   running_protocol_idx < numRunningProtocols;
   running_protocol_idx++){
 
print(runsetParser.GetRunningProtocol(running_protocol_idx).GetFilename())
print(runsetParser.GetRunningProtocol(running_protocol_idx).GetRunsetNotes())
//The runset notes might include items such as barcodes.
}
Related information
 
For information about...
See...
Using JavaScript in the VWorks software
VWorks-defined functions
Other VWorks-defined objects
Using JavaScript utilities
JavaScript task
Startup and cleanup protocols
VWorks Watcher tool
How to create a runset