Question
Cognizant Technology Solutions India PVT Ltd
IN
Last activity: 19 Sep 2019 6:29 EDT
Can we run VB Script (.vbs) code in Automation? If Yes, how that is?
As per my requirement need to use vb script. I tried to achieve with C# script but not found the solution.I got lot of vb script (extension with .vbs file)code solutions in google So, i want to utilize those script in my automation as reusable ones.If possible to run in Pega Robotic Studio, please tell me how to do so.
Thanks in Advance,
Gururaja.
-
Like (0)
-
Share this page Facebook Twitter LinkedIn Email Copying... Copied!
Pegasystems Inc.
IN
Hi,
The below link might help you.
https://collaborate.pega.com/question/using-vb-language-scripts-contructs
https://collaborate.pega.com/question/writing-vbnet
https://collaborate.pega.com/question/calling-batch-file-or-script-automation
Thank You,
Infosys
IN
Check the code here:
https://collaborate.pega.com/question/it-possible-run-vba-script-openspan
Cognizant Technology Solutions India PVT Ltd
IN
Thanks for your response.
I don't want to use VB.NET code. Want to use VB Script code which we can write in notepad/nodepad++ and save with extension of .vbs
Find the attached zip file (open it.zip) which contains vbscript file (Sample Date.vbs) for your reference. Can execute the code by double clicking on Sample Date.vbs script.
Infosys
IN
You want to execute .vbs file by double click from the automation?
Previous attached link explain how to execute .vbs file from automaton using c# script.
Cognizant Technology Solutions India PVT Ltd
IN
Thanks Jayachandra for giving solution.
I can run the simple parameterless code only, i can't pass parameters from c# to Vbscript and return the value from vbscript to c# method.
I tried to pass parameters as below
process.StartInfo.Arguments = <firstvar> + "<space>" + <secondvar>;
and dont know how to assign returned value from vbscript to c# variable.
Infosys
IN
Check this link
https://stackoverflow.com/questions/2992164/question-on-returning-values-from-vbscript-to-net
Cognizant Technology Solutions India PVT Ltd
IN
I could not found how they passed input parameters and returning output value from Vbscript through c#.
can you tell me what are the input and output parameters in below code;
I could not found how they passed input parameters and returning output value from Vbscript through c#.
can you tell me what are the input and output parameters in below code;
var p = new Process()
{
StartInfo = new ProcessStartInfo("netstat")
{
RedirectStandardOutput = true,
RedirectStandardError = true,
UseShellExecute = false,
}
};
var outputWriter = new StringWriter();
p.OutputDataReceived += (sender, args) => outputWriter.WriteLine(args.Data);
var errorWriter = new StringWriter();
p.ErrorDataReceived += (sender, args) => errorWriter.WriteLine(args.Data);
p.Start();
p.BeginOutputReadLine();
p.BeginErrorReadLine();
p.WaitForExit();
if (p.ExitCode == 0)
{
Console.WriteLine(outputWriter.GetStringBuilder().ToString());
}
else
{
Console.WriteLine("Process failed with error code {0}\nMessage Was:\n{1}", p.ExitCode
, errorWriter.GetStringBuilder().ToString());
}