cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
dragsdale
New Member

Executing JavaScript

I am experimenting the PAD Scripts.  I got the "Run VBScript" to work, now trying the "Run JavaScript" action.

 

I expected the statement: console.log("Text Here") to populate the return variable "JavascriptOutput", but it thru an exception.  Based upon a response from another user, I tried using "WScript.echo("Text Here") and it worked.

 

From what I have read, 'WScript" is can be used in JScript or VBScript, but the description says "Run JavaScript".  I don't know if this is an error or what.  I am an experienced reactive web developer, so I would like to be able to leverage JavaScript when possible.  

 

dragsdale_0-1616161143238.png

Thanks.  I am excited by the potential of PAD, it could be another game changer.

1 ACCEPTED SOLUTION

Accepted Solutions
fraenK
Memorable Member
Memorable Member

As you already figured out yourself, the runtime understands JScript, which is a ECMAscript based dialect from Microsoft. Console.log isn't part of the original spec, that's why it doesn't work.

 

You could run your JavaScript code within a browser of your choice with:

https://docs.microsoft.com/en-US/power-automate/desktop-flows/actions-reference/webautomation#execut...

View solution in original post

2 REPLIES 2
fraenK
Memorable Member
Memorable Member

As you already figured out yourself, the runtime understands JScript, which is a ECMAscript based dialect from Microsoft. Console.log isn't part of the original spec, that's why it doesn't work.

 

You could run your JavaScript code within a browser of your choice with:

https://docs.microsoft.com/en-US/power-automate/desktop-flows/actions-reference/webautomation#execut...

kelway
Advocate II
Advocate II

A caution I just discovered with javascript outputting a variable from WScript.echo: this will append a CRLF to the end, and so when I was trying to concatenate strings into a filename box with the variable, it was sending an enter to the dialogue and exiting it. Was more difficult to find than I would have liked.

Helpful resources

Announcements
Microsoft 365 Conference – December 6-8, 2022

Microsoft 365 Conference – December 6-8, 2022

Join us in Las Vegas to experience community, incredible learning opportunities, and connections that will help grow skills, know-how, and more.

Difinity Conference 2022

Difinity Conference 2022

Register today for two amazing days of learning, featuring intensive learning sessions across multiple tracks, led by engaging and dynamic experts.

European SharePoint Conference

European SharePoint Conference

The European SharePoint Conference returns live and in-person November 28-December 1 with 4 Microsoft Keynotes, 9 Tutorials, and 120 Sessions.

Top Solution Authors
Top Kudoed Authors
Users online (2,111)