Search code examples
c#flashautomationsendmessage

.NET webbrowser control automation


I'm trying to automate some stuff on a flash game running in a webbrowser control in my C# program. Using user32's sendmessage dll I've been able to click at coordinates on regular pages such as google but it doesn't work on flash content. Any ways I can do this? Also it cannot be detectable to the flash game. I have a working one in autoit but I'd like to rewrite it in c# and make it work minimized.


Solution

  • Why not just call your Autoit/Autohotkey script from your C# program using the System.Diagnostics.Process class?

    ProcessStartInfo psi = new ProcessStartInfo("your_script.ahk");
    psi.CreateNoWindow = true;
    
    Process procScript = Process.Start(psi);
    procScript.WaitForExit();
    

    Notice the CreateNoWindow=true to ensure it runs hidden, and the WaitForExit(), to make your code wait for the process to return.

    AutoIt and AutoHotkey have some very powerful automation commands that have been refined over the years. It's very hard to reproduce similar C#/.NET functionality that is just as reliable, believe me I've tried.