Skip to Content
Technical Articles

Another Way of JScript Development in IRPA Context

The execution unit, called Agent, of the SAP Robotics Process Automation solution IRPA uses JScript execution engine of Microsoft, which is also used in Windows Scripting Host and Internet Explorer 11. This engine called Chakra. Microsoft delivers with Windows 10 two different JavaScript engines which named Chakra. A new one, called Edge engine in the library chakra.dll, and an old one, called legacy engine in the library jscript9.dll which supports Internet Explorer 11. The further development of the legacy engine is frozen and will remain fundamentally unchanged from Win8.1/IE11 release.

Why im telling this all? That is very easy to explain. Based on this knowledge we can now use Windows standard and additional resources to use a supportive environment for programming JScript IRPA sequences. Because furthermore JScript is largely compatible with JavaScript. It includes some objects which are not supported by JavaScript, such as ActiveXObject, Enumerator, Error, Global, and VBArray, but they are used by IRPA. You can find more information at the JScript Language Reference.

A fantastic editor for this kind of requirement is Microsoft Visual Studio Code. For this experiment we create a tiny HTML stub to load a JScript file, I named it IRPA_Dev_Sequence.

<html>
  <head>
    <title>IRPA Development Sequence</title>
  </head>
  <body>
    <script type="text/javascript" src="IRPA_Dev_Sequence.js"></script>
  </body>
</html>

And with Visual Studio Code it is also possible to code in JScript. For this case I use a tiny example.

//-Begin----------------------------------------------------------------

var Shell = new ActiveXObject("WScript.Shell");
Shell.PopUp("Hello IRPA");

//-End------------------------------------------------------------------

Hint: You can also try your code with Windows Scripting Host. But don’t forget to save your JScript code not in UTF, only ANSI or ASCII, because JScript of the WSH doesn’t support UTF.

Now we can load our code into the Internet Explorer. In a normal case in Windows 10 the Edge engine will be used, but in our case it is necessary to use the legacy engine.

It is necessary to allow blocking content.

A security requester pops up..

… and after that our script runs in the context of Internet Explorer 11.

Why this complicated way? This is also easy to explain. The developer tools of the Internet Explorer offers us the possibility to debug our JScript code. You can open the developer tools with F12 key.

On this way we have the possibility to code JScript sequences for IRPA with VS Code and to test it with IE11 before we paste it into the IRPA code.

We use VS Code for a lot of our developments, e.g. PowerShell, HTML, JavaScript and (a little bit) ABAP. So it is only logical for us for our IRPA development to look for an integrated development scenario also. It’s not elegant at the moment, but it works. Of course this only applies as long as we do not use the IRPA objects itself. However, this is a possible way for independent developments which will be integrated into IRPA.

Be the first to leave a comment
You must be Logged on to comment or reply to a post.