The following code can be successfully run in QM (requires win10 or powershell5.1,Download the Jint.dll file to the root directory of the C drive), but the result is a lot of characters, and the display is different in powershell ise, how to display only the result 11?
Macro Macro9
Macro Macro9
str s
_s=
;function Invoke-JSAdd ($a, $b) {
;;;;;Add-Type –Path "C:\Jint.dll"
;;;;;;;;;;;;;;
;;;;;$JavaScript = "
;;;;;;;;;function add(a, b) {
;;;;;;;;;;;;;return a + b;
;;;;;;;;;}
;;;;;"
;;;;;$add = (New-Object Jint.Engine).
;;;;;;;;;;;;;Execute($JavaScript).
;;;;;;;;;;;;;GetValue("add")
;;;;;;;;;;;;;;
;;;;;$add.Invoke($a, $b).ToString()
;}
;
;Invoke-JSAdd 5 6
PsCmd _s "" s
mes s