Popular Post scintilla4evr Posted October 1, 2016 Popular Post Share Posted October 1, 2016 (edited) Hello! Microsoft Edge, the new browser released with Windows 10, uses Chakra as its JavaScript engine. In January, Microsoft released ChakraCore - the open source version of the engine that can be used in other apps. So, how about using it in AutoIt? I tried 2 times to create ChakraCore UDF, and I succeeded. So here it is - the ChakraCore UDF. Features: Executing JavaScript from AutoIt (obviously) Passing data from AutoIt to JavaScript Calling AutoIt functions from JavaScript ChakraCore UDF Have fun! Edited October 1, 2016 by scintilla4evr mLipok, coffeeturtle, Gianni and 3 others 6 Just Monika. Spoiler CompileIt - an experimental AutoIt-to-machine code compiler Apps: Power Calculator | AutoItFX | AudioBox | vPaint 4 | Color Book Editor UDFs: Advanced Math UDF | Blender UDF | Motion Graphics UDF | ColorEx UDF | ChakraCore UDF | CUDA UDF Adobe UDFs: Photoshop | ... Examples & Small Scripts: Distorting GDI+ Paths with other Paths | Combining GDI+ Paths with different combine modes | _WinAPI_DwmEnableBlurBehindWindow in Windows 10 | Running AutoIt code from any web browser Link to comment Share on other sites More sharing options...
Gianni Posted October 3, 2016 Share Posted October 3, 2016 looks interesting, p.s. (seems the answer to what I was wondering here.... ) thanks for sharing Chimp small minds discuss people average minds discuss events great minds discuss ideas.... and use AutoIt.... Link to comment Share on other sites More sharing options...
Gianni Posted October 5, 2016 Share Posted October 5, 2016 (edited) Is there any way of instantiating the "chakra.dll" in the form of an object? something similar to as described here (but for C#), where this command 'host = new ChakraHost();" is used to instantiate Chakra as an object, and then the dot notation syntax is used to call the methods 'host.CallFunction("commitFunction");' ......? Edited October 5, 2016 by Chimp Chimp small minds discuss people average minds discuss events great minds discuss ideas.... and use AutoIt.... Link to comment Share on other sites More sharing options...
scintilla4evr Posted October 5, 2016 Author Share Posted October 5, 2016 (edited) 3 hours ago, Chimp said: Is there any way of instantiating the "chakra.dll" in the form of an object? I think that would require wrapping the functions in some kind of COM object (AutoItObject for example), since ChakraCore.dll exposes only "flat API", i.e. exported DLL functions. ("Note that JSRT APIs are C++ APIs, this sample assumes a C# wrapper.", as it says on the Embedding ChakraCore page). Edited October 5, 2016 by scintilla4evr Just Monika. Spoiler CompileIt - an experimental AutoIt-to-machine code compiler Apps: Power Calculator | AutoItFX | AudioBox | vPaint 4 | Color Book Editor UDFs: Advanced Math UDF | Blender UDF | Motion Graphics UDF | ColorEx UDF | ChakraCore UDF | CUDA UDF Adobe UDFs: Photoshop | ... Examples & Small Scripts: Distorting GDI+ Paths with other Paths | Combining GDI+ Paths with different combine modes | _WinAPI_DwmEnableBlurBehindWindow in Windows 10 | Running AutoIt code from any web browser Link to comment Share on other sites More sharing options...
Gianni Posted October 6, 2016 Share Posted October 6, 2016 Hi @scintilla4evr, thanks for your answer I was wondering if what says @guinness in his topic here, could be used with this chakradll as well..? anyway, back on your udf, could you show how to use it if, for example, I would like to use the functions from this 'moment' javascript library directly from AutoIt? (library found on this nice site) any example is welcome Thank You Chimp small minds discuss people average minds discuss events great minds discuss ideas.... and use AutoIt.... Link to comment Share on other sites More sharing options...
PifPaf Posted November 20, 2016 Share Posted November 20, 2016 Help a poor newbie ! Congratulations, but I can't find out what's wrong with chakracore.au3 when calling a quite basic execution on the example 1 mode : (function() { var h = window.document.location.href ; return h ; })(); Many thanks in advance. test.au3 test.js Link to comment Share on other sites More sharing options...
junkew Posted November 27, 2016 Share Posted November 27, 2016 I assume from first example the answer should be 25. I get 1 as an answer. JavaScript Output: 1 W10, 64 bits I am running on FAQ 31 How to click some elements, FAQ 40 Test automation with AutoIt, Multithreading CLR .NET Powershell CMDLets Link to comment Share on other sites More sharing options...
junkew Posted November 27, 2016 Share Posted November 27, 2016 Func _ChakraCore_Startup($sDllFile = "Chakra.dll") I had to remove the core part from the dll name and then it works. Powefull extension My output from the examples JavaScript Output: 5 JavaScript Output: 13 JavaScript Output: llo Wor JavaScript Output: Lorem ipsum dolor sit amet a: 320 b: !dlroW olleH FAQ 31 How to click some elements, FAQ 40 Test automation with AutoIt, Multithreading CLR .NET Powershell CMDLets Link to comment Share on other sites More sharing options...
scintilla4evr Posted January 14, 2017 Author Share Posted January 14, 2017 On 11/20/2016 at 4:04 PM, PifPaf said: Help a poor newbie ! Congratulations, but I can't find out what's wrong with chakracore.au3 when calling a quite basic execution on the example 1 mode : (function() { var h = window.document.location.href ; return h ; })(); Many thanks in advance. test.au3 test.js Sorry for such a GIGANTIC delay in answering this question. You can't use window.document.<blah blah insert some object here> in ChakraCore, because the window object is exposed only by web browsers. This UDF only gives access to "raw" JavaScript, so there are no browser-specific objects - no window, navigator, DOM, etc. Just Monika. Spoiler CompileIt - an experimental AutoIt-to-machine code compiler Apps: Power Calculator | AutoItFX | AudioBox | vPaint 4 | Color Book Editor UDFs: Advanced Math UDF | Blender UDF | Motion Graphics UDF | ColorEx UDF | ChakraCore UDF | CUDA UDF Adobe UDFs: Photoshop | ... Examples & Small Scripts: Distorting GDI+ Paths with other Paths | Combining GDI+ Paths with different combine modes | _WinAPI_DwmEnableBlurBehindWindow in Windows 10 | Running AutoIt code from any web browser Link to comment Share on other sites More sharing options...
dariel Posted March 1, 2019 Share Posted March 1, 2019 (edited) Hi, i don't manage to make work any example, always return 1, any help? Fixed, i was using 64bits OS so i add #AutoIt3Wrapper_UseX64=n Edited March 1, 2019 by dariel Found the solution. Link to comment Share on other sites More sharing options...
HamidZaeri Posted December 29, 2019 Share Posted December 29, 2019 (edited) I have a code like this. (function(helloWorldString1) { return helloWorldString1.substr(2, 7); })(); (function(helloWorldString2) { return helloWorldString2.substr(3, 7); })(); (function(helloWorldString3) { return helloWorldString3.substr(4, 7); })(); How can I get the string result for the last function? Or how can i get multiple result from a js code? Edited December 29, 2019 by HamidZaeri Link to comment Share on other sites More sharing options...
malcev Posted May 9, 2023 Share Posted May 9, 2023 Just found a bug. Before calling JsDisposeRuntime We need to set set current context to not existent one with JsSetCurrentContext function. Link to comment Share on other sites More sharing options...
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now