Jump to content

autoit and javascript


Recommended Posts

returning to autoit after lengthy absence to continue a javascript related project. Javascript needs to trigger autoit  manipulation of an app on the same box. When I left I think this was only possible running the IE or Firefox UDFs which I must admit I could not get much functionality out of ( probably my lack of understanding!). I was running an apache web server and a web page and autoit and the music app on the same box. We now have node.js, and I want to use serverside nodejs javascript to call autoit functions to manipulate the music app that obviously still has to run on the nodejs box with autoit for mouse control. I found ChakraCore but wanted to ask the question first: can nodejs javascript trigger autoit functions with passed parameters and if so is it limited or are all autoit and UDF functions available through javascript calls to autoit functions. Thanks in advance.

Link to comment
Share on other sites

I was wondering something similar in this post

maybe you can find some useful hints there ...

Edited by Chimp
syntax

 

image.jpeg.9f1a974c98e9f77d824b358729b089b0.jpeg Chimp

small minds discuss people average minds discuss events great minds discuss ideas.... and use AutoIt....

Link to comment
Share on other sites

@junkew: found your post from Sept 2017 r.e. Chakra: " Maybe this is also interesting for microsoft edge javascript if you just need javascript unrelated to an html dom " ... and Chimp same thread : "" using Chakra is a nice and handy way to have javascript at your fingertips if you don't need to interact with a DOM. I found the ChakraCore UDF from scintilla with feature: "Calling AutoIt functions from JavaScript", installed it and have the 5 examples working within AutoIt, but they are all initiated from within AutoIt - nothing initiated from within javascript. Have not touched AutoIt for a few years so I know the rust needs to be brushed off ... the ChakraCore UDF is of course an AutoIt.au3 file - I got really excited when I saw "Example 4 - Calling AutoIt functions from JavaScript.au3" - but again logically initiated from within AutoIt. I know what you are saying about the tcp ip route, but for me I think that would be hard labour 😞 .. what I was doing with IE and your IUIAutomation UDF was of course all within the IE scope but I created a queue of events (array) that I wanted AutoIt to process, poked commands into the queue e.g. 'move mouse to x, y', and then popped events off that queue and processed them using a timer. Does it sound feasible and even maybe a little elegant to use nodejs on the server to do the same thing, push events into a queue ( would that have to be a physical file or could both node javascript and AutoIt reference the same in-memory array variable etc?)  and have AutoIt poll that queue at fixed intervals, pop from the queue and go off and do its thing with the mouse etc? Since I need to push and pop the queue very quickly - automated mixing control of live music - maybe pushing and popping to a physical file would cause all kind of contention?

I am infinitely better at fullstack javascript than AutoIt at the moment so really appreciate your thoughts on all this.

was typing and just refreshed to see @Chimp suggestions - am looking at this now and thank you.

Edited by crzymnmchl
Link to comment
Share on other sites

to call AutoIt functions in response to events generated by the DOM in the browser, you should use the AutoIt function ObjEvent(). Maybe it's a little different for the events generated directly by JavaScript for which a higher level of integration is needed. In the previous post that I pointed above, @trancexx showed a way to get it using the ObjCreateInterface() function, but, although I tried to understand how to implement it even in contexts other than that specific one, I have to admit that I am not been able to do it or even just to understand in depth how ObjCreateInterface () should be used in general  (javascripts) contexts to catch it's events from AutoIt.

Edited by Chimp

 

image.jpeg.9f1a974c98e9f77d824b358729b089b0.jpeg Chimp

small minds discuss people average minds discuss events great minds discuss ideas.... and use AutoIt....

Link to comment
Share on other sites

just thinking out loud and maybe crazy ... is the windows clipboard a saved file or an in-memory object? npm install clipboardy allows both async and sync read and write to the clipboard and I know AutoIt has extensive clipboard functions - could the clipboard be used as the queue? (Not sure about "collision avoidance")

edit: hah the windows clipboard is in memory and apparently there are are a couple of apps that allow multiple clipboards - not sure whether either node javascript or AutoIt could access these enhanced clipboards but am going to play with this and find out - might be an awesome way of sharing info between js and autoscript.

Edited by crzymnmchl
Link to comment
Share on other sites

hopefully withing scope - just found npm autoit - unsupported, does not work with current node ... installed nodist and have been slowly regressing version of node in attempt to get npm install autoit to work ... does anybody have any experience of this or is it so old and buggy not worth the attempt?

Link to comment
Share on other sites

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 account

Sign in

Already have an account? Sign in here.

Sign In Now
 Share

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...