Can you tell me why you would expect an Integer result at any time?
I suppose the engine chooses to return numbers as VT_I4 when possible.MDN wrote:The Number type is a double-precision 64-bit binary format IEEE 754 value.
I suppose the engine chooses to return numbers as VT_I4 when possible.MDN wrote:The Number type is a double-precision 64-bit binary format IEEE 754 value.
I am expecting to get string without zeroes at the end as result.Can you tell me why you would expect an Integer result at any time?
Code: Select all
sScript = eval("2147483648");
DllCall("LoadLibrary", "str", "ChakraCore.dll", "ptr")
DllCall("ChakraCore.dll\JsCreateRuntime", "uint", 0, "ptr", 0, "ptr*", hRuntime)
DllCall("ChakraCore.dll\JsCreateContext", "ptr", hRuntime, "ptr*", hContext)
DllCall("ChakraCore.dll\JsSetCurrentContext", "ptr", hContext)
DllCall("ChakraCore.dll\JsRunScript", "wstr", sScript, "uint", 0, "wstr", "", "ptr*", hResult)
DllCall("ChakraCore.dll\JsConvertValueToNumber", "ptr", hResult, "ptr*", tResult)
DllCall("ChakraCore.dll\JsNumberToDouble", "ptr", tResult, "double*", hOutput)
DllCall("ChakraCore.dll\JsSetCurrentContext", "ptr", 0)
DllCall("ChakraCore.dll\JsDisposeRuntime", "ptr", hRuntime)
msgbox % hOutput
Code: Select all
a := 0.000
a++
msgbox % a
Code: Select all
sScript := "(function(){var obj = {a: 1.035};return obj;})();"
DllCall("LoadLibrary", "str", "ChakraCore.dll", "ptr")
DllCall("ChakraCore.dll\JsCreateRuntime", "uint", 0, "ptr", 0, "ptr*", &hRuntime:=0)
DllCall("ChakraCore.dll\JsCreateContext", "ptr", hRuntime, "ptr*", &hContext:=0)
DllCall("ChakraCore.dll\JsSetCurrentContext", "ptr", hContext)
DllCall("ChakraCore.dll\JsRunScript", "wstr", sScript, "uint", 0, "wstr", "", "ptr*", &hOutput:=0)
DllCall("ChakraCore.dll\JsGetPropertyIdFromName", "wstr", "a", "ptr*", &hPropId:=0)
DllCall("ChakraCore.dll\JsGetProperty", "ptr", hOutput, "ptr", hPropId, "ptr*", &hResult:=0)
DllCall("ChakraCore.dll\JsConvertValueToNumber", "ptr", hResult, "ptr*", &tResult:=0)
DllCall("ChakraCore.dll\JsNumberToDouble", "ptr", tResult, "double*", &hOutput:=0)
DllCall("ChakraCore.dll\JsSetCurrentContext", "ptr", 0)
DllCall("ChakraCore.dll\JsDisposeRuntime", "ptr", hRuntime)
msgbox hOutput
Code: Select all
a:=1.034
a+=0.001
msgbox a
Code: Select all
vb := ComObjCreate("MSScriptControl.ScriptControl")
vb.Language := "JSCript"
vb.eval("12*2")
Sure, but if you look at the first post of this topic, you'll read:Kingron wrote: ↑23 May 2023, 08:11Here is the simple way to run VBScript & JScript:Code: Select all
vb := ComObjCreate("MSScriptControl.ScriptControl") vb.Language := "JSCript" vb.eval("12*2")
Provides an interface to Active Scripting languages like VBScript and JScript, without relying on Microsoft's ScriptControl, which is not available to 64-bit programs.
Return to “Scripts and Functions (v1)”
Users browsing this forum: No registered users and 244 guests