Sign in to follow this  
Followers 0
BruceCopperField

Using AutoItX for Javascript exe Interprocess Communication

7 posts in this topic

#1 ·  Posted (edited)

I need to write 2 programs in 2 completely different environments and have them to communicate. I am wondering if my idea involving AutoItX works or not. Here it is:

My first program is written in Javascript for parsing the DOM tree of a web page. The second program is just an ordinary exe (perhaps created by Aut2exe) with some GUI. I need the 2 to be able to send/recv info to each other. My idea is to embed AutoItX COM in the javascript and then using its ControlSetText()/ControlGetTText() to retrieve text from an arbitrary control hidden in my second exe.

Does my idea work? Or is there any other better way to achieve the same interprocess communication (with or without using AutoItX). I know the issue is more about writing a COM for my javascript and the reason I choose AutoItX is that I am not technically capable of writing a COM using C++ or other programming language (I'm from Java)

Edited by BruceCopperField

Share this post


Link to post
Share on other sites



You'd be better off parsing the DOM structure in the same program you need it in. I'm sure there's a DOM interface for whatever language you pick.

Share this post


Link to post
Share on other sites

I am writing my own web browser automation tool for automatically responding to a complex web site base on the information returned from the web server which may include text or images. I found that the best way to get and analyse the content returned by a web server is Javascript because of its ability to read and parse the HTML DOM (many web appli. auto functional testing framework like Selenium is using javascript). I also plan to use Javascript to emulate mouse click and keyboard event (yes, this is available in javascript) instead of relying on the send() and mouse click feature of autoit.

Although javascript is a good tool for analysing web page content, it isnt good at doing other things like AI so I need to write my AI using other Expert system shell and need some form of interprocess communication between 2 different programs.

Share this post


Link to post
Share on other sites

Well, I guess you could use AutoItX to "send" data to other applications, but it would still be better to get a DOM parser and not use interprocess communications.

Share this post


Link to post
Share on other sites

#5 ·  Posted (edited)

Although javascript is a good tool for analysing web page content, it isnt good at doing other things like AI so I need to write my AI using other Expert system shell and need some form of interprocess communication between 2 different programs.

What do you mean by "AI"? Artificial Intelligence or Automation Interface? Because in your earlier posts you mention GUI. If you meant Artificial intelligence, then not sure what you had in mind.

If you meant GUI, don't think you can share data easily over COM between AutoIt and javascript, especially if you execute from a webpage. To call local COM objects, you'd have to set your browser security options to allow accessing local COM interfaces on the computer, otherwise the browser will block your COM instantiation and COM calls. If you really wanted to go that route, you should make your web-based javascript to be encapsulated within an Internet Explorer HTA application that uses javascript for its client side scripting. HTA applications get full access rights to the local system as if they are local applications but run from a web browser (IE) that can communicate with online websites. Also COM within a browser works best with IE than other browsers like Firefox.

Edited by daluu

Share this post


Link to post
Share on other sites

#6 ·  Posted (edited)

What do you mean by "AI"? Artificial Intelligence or Automation Interface? Because in your earlier posts you mention GUI. If you meant Artificial intelligence, then not sure what you had in mind.

If you meant GUI, don't think you can share data easily over COM between AutoIt and javascript, especially if you execute from a webpage. To call local COM objects, you'd have to set your browser security options to allow accessing local COM interfaces on the computer, otherwise the browser will block your COM instantiation and COM calls. If you really wanted to go that route, you should make your web-based javascript to be encapsulated within an Internet Explorer HTA application that uses javascript for its client side scripting. HTA applications get full access rights to the local system as if they are local applications but run from a web browser (IE) that can communicate with online websites. Also COM within a browser works best with IE than other browsers like Firefox.

Daluu,

You are making a good point, and yes I was planning to use html application (HTA) to bypass the same origin policy of web browser. So far, I can't find any satisfactory solution for Firefox so I have to live with Micros...hit. "AI" I mentioned is indeed Artificial Intelligence. Well, I think you could guess what I am trying to acomplishPosted Image . It is a bot for a web based strategic online game Posted Image which I plan to implement using Expert System shell (for its strategic thinking capability) plus automation routine to send/recv command from the web browser which would be based on Javascript running on an HTA appli.

The reason why Autoit get involved (apart from the need to send key press to browser) is because the AutoItX COM object which allows me to extend my hta program written in javascript to communicate with another win32 process (my AI strategy engine) by its ControlGetText()/ControlSetText(). I am not sure if this is a good architecture at all so better to consult the experts here first. The baseline is, I need to do diifferent tasks and the best tools for each task is completely different from other tools involved so finding a way to have them communicate seems to be the best choice compared to, say, having to learn and implement a solution using a single tool (VC++ etc).

Edited by BruceCopperField

Share this post


Link to post
Share on other sites

The problem here is that you are writing a bot.

Share this post


Link to post
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
Sign in to follow this  
Followers 0