Sign in to follow this  
Followers 0
evandude

Interfacing with C#

3 posts in this topic

Just for fun, I am working on a script to play a simple flash game. I've gotten to the point where I can successfully screen-scrape to get all the necessary information to play the game, and of course can send mouse clicks to the appropriate buttons.

Now I'm at the point where I need to write the AI to actually implement a strategy to successfully play the game. I feel like trying to implement the AI in AutoIt would be a bit tedious, as compared to doing it in C#, a language with which I'm much more familiar.

Basically, right now I am trying to get a little guidance on how to approach the problem, as it seems like there's a few possibilities and I'm not familiar enough with them to know which is the most straightforward for what I need. I don't need detailed assistance (though any examples you can point me to would be appreciated), just a nudge in the right direction.

How complicated is it to have an AutoIt script interact with a C#.NET program? All I really need to do is have the AutoIt script send some simple state information about the game to the C# program, and have it return some simple data indicating what the next move should be.

I see that I can have my script RUN an executable, but I am not sure if it's possible to get data back from it when it finishes. The COM interface seems promising but the examples I saw in the help file seemed focused on using built-in objects like excel, so I'm not entirely sure of how many hoops I'd have to jump through to get my C# program compatible with that interface. Are there other methods as well?

Or, would it be any easier to go the other way - have the C# program be in control, and call AutoIt functions from there?

Thanks in advance...

Share this post


Link to post
Share on other sites



Hi,

you can just use a file (INI,XML) to share information between the apps, i havnt tried any other way yet so if you think of something please let us know:)

Share this post


Link to post
Share on other sites

COM will work. Creating a C# COM object is rather simple. Perhaps though, you'd be better off using the console. You can read and write to the programs's standard streams even if it's a GUI application.

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