Showing results for 
Search instead for 
Did you mean: 

How to control an HTA application?



I have some days working on an HTA application. I want to control it throught LabVIEW.


There are possible solutions:


1) This one worked but Im not satisfied: The approach I used is to modify a bit the code, javascript and HTML. Then open it and controlling the button events with my LabVIEW VI. I used this approach in the past with other applications with success.

But for some reason functions from User32.dll does not work for this application, for example if I list the opened windows, the hta application is not visible.

So i did some tricks to make the window active, added "ALT + letter" shortcuts to each button i need to use, so I can control it on that way. If the hta is updated, i need to do some changes to the code.


2) Calling external Javascript (
My tests here didnt worked. I need to delete all HTML code from the HTA and do some replacements to read the script file. But when i call fucntions i had errors that I cant fix.


3) ActiveX web browser (

There are errors when loading the hta (renamed as htm to open it here). I tried to load the original hta as htm, and also the modified hta file, but got same errors.



Question is:

¿Can someone recommend another way to do this?
Also if someone knows how to make work user32.dll functions with this application, would be realy useful.


0 Kudos
Message 1 of 5
What I have used with standard widows applications is AutoIt. I have no idea if it will work for an hta app, though.
0 Kudos
Message 2 of 5

Thanks by your response.
Let me investigate about it, never heard about Autolt before. I will post my results here.

0 Kudos
Message 3 of 5
There are some LabVIEW examples floating around somewhere. Just do a search.
0 Kudos
Message 4 of 5

Problem here is that i dont know a way to get the hta application window handle. I did research in google but didnt find someone that know how to do this.
So I dont have a way to use it with user32.dll or AutoIt.


Thanks by your help, I didnt knew about AutoIt so this helped me to learn something new.


My solution was to do some changes to the hta file. Then replace files path in the code, open it in LabVIEW and add task automatically by code.

When the HTA finished and labview need to do some actions, what i did is change the hta window name. LabVIEW is waiting for this, so when it found the waited name, do some actions and then give control again to HTA using keyboard event. Then the hta close it itself.

0 Kudos
Message 5 of 5