Jump to content

AutoIT functions don't appear to work when called from an ASP.net WebAPI


Recommended Posts

Hi,
I'm trying to create a procedure that can do some repeating actions on a particular program window like typing some commands, clicking some buttons and stuff like that.
I'm using the nuget AutoIT (version 3.3.12) package for .net
I want to do this using a webAPI hosted on a remote VM, so upon a request the program would do some task and return a result.

I've created an ASP.net WebAPI and when I run it from Visual Studio (or Rider) the request goes though and all the autoIT function calls run as expected, but when I deploy the webAPI on IIS and try to make the request the autoIT function call don't appear to work. Everything else works.

I've been trying to debug this by logging to a text file and for instance the first AutoIT function that I call is:

var hWnd = AutoItX.WinGetHandle(_winTitle);

to grab the window handle of the program I want to manipulate, and when I write the hWnd value to the log file I see that that value is zero. Which doesn't happen when running directly from Visual Studio.
Maybe I'm missing some permission that I have to give to the API, or missing dlls or something like that. I'm not very experienced on ASP.net, so I could be doing something incorrectly.

If someone has any idea on what can be the problem, please help.

Kind regards,

Carlos 
 

Link to post
Share on other sites

Are you saying that you want to install AutoItX on your web server in order to have AutoItX execute commands on remote computers, through a web API?

Link to post
Share on other sites

Hi TheXman, thanks for the reply.
Not on remote computers, I want to have AutoItX execute commands on an app running in a server. And those commands would be triggered by http requests.
The AutoItX and the App I want it to manipulate  would be running both on a remote windows VM.

Link to post
Share on other sites

Okay, I understand what you are asking and trying to do.

If you don't want to have to deal with IIS and ASP.Net, then the HTTPAPI UDF in my signature or one of the other AutoIt-based web servers would be much easier to implement.  That would also give you access to all of the AutoIt functionality as opposed to the subset that AutoItX exposes.

Edited by TheXman
Link to post
Share on other sites

Mine is basically a wrapper for the Microsoft Win32 HttpAPI APIs.  The benefit is that it is documented by Microsoft, there are numerous examples of its implementation on the web, and the Win32 APIs use HTTP standards for communication.

This is another light-weight web server that is built upon a different framework.  It might be even easier to implement than the HTTPAPI UDF because it is designed specifically around wrapping web services around AutoIt scripts.

 

Edited by TheXman
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
  • Recently Browsing   0 members

    No registered users viewing this page.

×
×
  • Create New...