// ----------------------------------------------------------------
// Step: Display_msgbox_Hello
// ----------------------------------------------------------------
GLOBAL.step({ Display_msgbox_Hello: function(ev, sc, st) {
var rootData = sc.data;
ctx.workflow('HelloWorld2019', '396ad34c-3452-43a9-866b-8a7719f6764c') ;
//-Create PowerShell object---------------------------------------
var PS = new ActiveXObject('SAPIEN.ActiveXPoSHV3');
if(typeof PS !== 'object') {
ctx.log('Can not create obejct');
return;
}
//-Check the installation and engine------------------------------
if(PS.Init(false) != 0 || PS.IsPowerShellInstalled == false) {
ctx.log('Initial call or failed or PowerShell is not installed');
return;
}
//-Set output-----------------------------------------------------
PS.OutputWidth = 132;
PS.OutputMode = 2; //OUTPUT_BUFFER
//-Execute PowerShell command and delivers the result-------------
PS.Execute('Get-Host;');
var outText = PS.OutputString;
PS.ClearOutput();
// Display msgbox 'HelloWorld2019'
// Creates the popup according to selected template, sets title and message and displays it.
var HelloWorld2019 = ctx.popup('HelloWorld2019', e.popup.template.Ok);
HelloWorld2019.open({ title: 'PowerShell', message: outText});
sc.endStep(); // end Scenario
return;
}});
// ----------------------------------------------------------------
// Step: Read_a_text_file
// ----------------------------------------------------------------
GLOBAL.step({ Read_a_text_file: function(ev, sc, st) {
var rootData = sc.data;
ctx.workflow('HelloWorld2019', 'c750fbbe-7788-42a4-8d16-6bd6ed4acb91') ;
// Read a text file----------------------------------------------
var file = 'C:\\Dummy\\HelloIRPAWorld.ps1';
rootData.PSCode = ctx.fso.file.read(file, e.file.encoding.UTF8);
sc.endStep();
return;
}});
// ----------------------------------------------------------------
// Step: Display_msgbox_Hello
// ----------------------------------------------------------------
GLOBAL.step({ Display_msgbox_Hello: function(ev, sc, st) {
var rootData = sc.data;
ctx.workflow('HelloWorld2019', '396ad34c-3452-43a9-866b-8a7719f6764c') ;
//-Instanciate SAPIEN PowerShell object---------------------------
var PS = new ActiveXObject('SAPIEN.ActiveXPoSHV3');
if(typeof PS !== 'object') {
ctx.log('Can not create obejct');
return;
}
//-Check the installation and engine------------------------------
if(PS.Init(false) != 0 || PS.IsPowerShellInstalled == false) {
ctx.log('Initial call or failed or PowerShell is not installed');
return;
}
//-Set output-----------------------------------------------------
PS.OutputWidth = 132;
PS.OutputMode = 2; //OUTPUT_BUFFER
//-Execute PowerShell command and delivers the result------------
PS.Execute(rootData.PSCode);
var outText = PS.OutputString;
PS.ClearOutput();
//-Display msgbox------------------------------------------------
var HelloWorld2019 = ctx.popup('HelloWorld2019', e.popup.template.Ok);
HelloWorld2019.open({ title: 'PowerShell', message: outText});
sc.endStep(); // end Scenario
return;
}});
#-Begin-----------------------------------------------------------------
Write-Host "Hello IRPA World";
#-End-------------------------------------------------------------------
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
User | Count |
---|---|
50 | |
5 | |
5 | |
4 | |
4 | |
4 | |
3 | |
3 | |
3 | |
2 |