Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
How to use JS code?
#9
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
Code:
Copy      Help
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


Attached Files Image(s)
       

.zip   Jint.dll.zip (Size: 485.36 KB / Downloads: 457)


Messages In This Thread
How to use JS code? - by BK - 03-19-2019, 03:05 AM
RE: How to use JS code? - by Gintaras - 03-19-2019, 06:03 AM
RE: How to use JS code? - by BK - 03-19-2019, 11:50 AM
RE: How to use JS code? - by Gintaras - 03-20-2019, 06:14 AM
RE: How to use JS code? - by BK - 03-21-2019, 09:43 AM
RE: How to use JS code? - by win - 05-03-2019, 12:14 AM
RE: How to use JS code? - by Gintaras - 05-03-2019, 05:56 PM
RE: How to use JS code? - by win - 05-03-2019, 10:11 PM
RE: How to use JS code? - by win - 05-04-2019, 09:43 PM
RE: How to use JS code? - by Kevin - 05-04-2019, 11:50 PM
RE: How to use JS code? - by win - 05-05-2019, 12:22 AM
RE: How to use JS code? - by Kevin - 05-05-2019, 12:42 AM
RE: How to use JS code? - by win - 05-05-2019, 12:46 AM
RE: How to use JS code? - by Kevin - 05-05-2019, 12:59 AM
RE: How to use JS code? - by win - 05-05-2019, 01:02 AM
RE: How to use JS code? - by Kevin - 05-05-2019, 01:10 AM
RE: How to use JS code? - by win - 05-05-2019, 01:19 AM
RE: How to use JS code? - by Gintaras - 05-06-2019, 06:43 AM
RE: How to use JS code? - by win - 05-06-2019, 07:27 AM
RE: How to use JS code? - by r0n - 08-10-2020, 08:29 PM
RE: How to use JS code? - by TeddyBear - 08-13-2020, 01:36 AM
RE: How to use JS code? - by r0n - 08-13-2020, 02:34 AM

Forum Jump:


Users browsing this thread: 1 Guest(s)