Jump to content

Autoit with C#


iLuvAutolt
 Share

Recommended Posts

Hi all (Please bear with me with a boring lengthy intro),

I am not an IT person and consider myself a handymen-coder. I use an application for work that is hard to use, in that i have to manually keep feeding different inputs  that this application requires to do my job. It was so tedious that i started writing  c# code to automate this tedious tasks.

...then i stumbled upon Autolt today and loved it! I thought Autolt is so wonderful i made an instant donation!

I wrote my first script called RunMyApp and converted to an .exe.

ControlFocus("My App", "my form", "[NAME:CForm; ID:2]")
MouseClick ( "left" , 480, 220  )
AutoItSetOption("SendKeyDelay", 100)
Send("myInput")
send("{ENTER}")
ControlSend("My App", "my form", "[NAME:CForm; ID:2]", "{F5}") 

I then use this autolt created .exe in a simple c# code as follows:

System.Diagnostics.Process.Start(@"C:\RunMyApp.exe");
            label1.Content = "runnig my app";

What i really want is to  do is execute the RunMyApp with different value for myInput in the code Send("myInput").

Can some body show me how i can replicate this small Autolt script in c# code by making call to the  AutoItX class for C# being discussed here? 

Or alternatively can an autolt created .exe receive input from my c# code, i.e. can i send value for "myInput" variable to  Autolt created RunMyApp.exe from my c# code? 

Thanks for taking time to read this looonnnggg post :). Thanks in advance.

Link to comment
Share on other sites

If Not $CmdLine[0] Then
    Exit -1
EndIf

ControlFocus("My App", "my form", "[NAME:CForm; ID:2]")
MouseClick ( "left" , 480, 220  )
AutoItSetOption("SendKeyDelay", 100)
Send($CmdLine[1])
send("{ENTER}")
ControlSend("My App", "my form", "[NAME:CForm; ID:2]", "{F5}")
System.Diagnostics.Process.Start(@"C:\RunMyApp.exe", "myinput");
label1.Content = "runnig my app";

Edited by JohnOne

AutoIt Absolute Beginners    Require a serial    Pause Script    Video Tutorials by Morthawt   ipify 

Monkey's are, like, natures humans.

Link to comment
Share on other sites

  • 3 weeks later...

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
 Share

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...