ArmandsBruns
13 years agoFrequent Contributor
Convert JScript To VBScript
Hi,
Can you please convert me the following JScript function into its equivalent VBScript (TestComplete)
Thanks
-----------------------------------------------------
function getResults()
{
Log.Message("See Information data in the Additional Info panel", getInformationData());
}
function getInformationData()
{
var tempFolder = aqEnvironment.GetEnvironmentVariable("temp") + "\\" + Math.floor(Math.random() * 10000) + "\\";
aqFileSystem.CreateFolder(tempFolder);
Log.SaveResultsAs(tempFolder, lsXML);
var xDoc = Sys.OleObject("MSXML2.DOMDocument.4.0");
xDoc.load(tempFolder + "Description.tcLog");
// Warning count
var wrnC = VarToInteger(xDoc.selectSingleNode('Nodes/Node[@name="root"]/Prp[@name="warning count"]/@value').text);
//Error count
var errC = VarToInteger(xDoc.selectSingleNode('Nodes/Node[@name="root"]/Prp[@name="error count"]/@value').text);
//Execution time
var startTime = VarToFloat(xDoc.selectSingleNode('Nodes/Node[@name="root"]/Prp[@name="start time"]/@value').text);
var stopTime = VarToFloat(xDoc.selectSingleNode('Nodes/Node[@name="root"]/Prp[@name="stop time"]/@value').text);
aqFileSystem.DeleteFolder(tempFolder, true);
var res =
"Errors: " + errC + "\r\n" +
"Warnings: " + wrnC + "\r\n" +
"Start Time: " + DateTimeToStr(startTime) + "\r\n" +
"Stop Time: " + DateTimeToStr(stopTime) + "\r\n" +
"Run Time: " + aqConvert.DateTimeToFormatStr(stopTime - startTime, "%H:%M:%S");
return res;
}
-----------------------------------------------------
Can you please convert me the following JScript function into its equivalent VBScript (TestComplete)
Thanks
-----------------------------------------------------
function getResults()
{
Log.Message("See Information data in the Additional Info panel", getInformationData());
}
function getInformationData()
{
var tempFolder = aqEnvironment.GetEnvironmentVariable("temp") + "\\" + Math.floor(Math.random() * 10000) + "\\";
aqFileSystem.CreateFolder(tempFolder);
Log.SaveResultsAs(tempFolder, lsXML);
var xDoc = Sys.OleObject("MSXML2.DOMDocument.4.0");
xDoc.load(tempFolder + "Description.tcLog");
// Warning count
var wrnC = VarToInteger(xDoc.selectSingleNode('Nodes/Node[@name="root"]/Prp[@name="warning count"]/@value').text);
//Error count
var errC = VarToInteger(xDoc.selectSingleNode('Nodes/Node[@name="root"]/Prp[@name="error count"]/@value').text);
//Execution time
var startTime = VarToFloat(xDoc.selectSingleNode('Nodes/Node[@name="root"]/Prp[@name="start time"]/@value').text);
var stopTime = VarToFloat(xDoc.selectSingleNode('Nodes/Node[@name="root"]/Prp[@name="stop time"]/@value').text);
aqFileSystem.DeleteFolder(tempFolder, true);
var res =
"Errors: " + errC + "\r\n" +
"Warnings: " + wrnC + "\r\n" +
"Start Time: " + DateTimeToStr(startTime) + "\r\n" +
"Stop Time: " + DateTimeToStr(stopTime) + "\r\n" +
"Run Time: " + aqConvert.DateTimeToFormatStr(stopTime - startTime, "%H:%M:%S");
return res;
}
-----------------------------------------------------