Jump to content

Using AutoIt in VB.NET


daluu
 Share

Recommended Posts

This is a repost from http://www.d3scene.com/forum/development/82572-tutorial-use-autoit-vb-net.html that I came across today. I don't think it is cross posted here already doing a search for .NET related stuff here. Please move to appropriate forum if posted to wrong one (e.g. ActiveX/COM Help and Support (AutoItX) or General Help and Support). If already duplicated here, please delete.

Thought it deserves a copy here w/o having users to register over at the source forum to see it. I've yet to personally try the example though, plan to soon. Perhaps a good idea to later on provide the C# version of code snippet for comparison purposes.

Original post info modified for clarity:

 

In this tutorial you will learn how to use Autoit functions in VB.NET(and C#)

 
Things you need :
 
Microsoft Visual Basic.NET(or C#) 2010 Express (or any other versions)
AutoitX Library which is in attachments
 
Create a new (VB).NET project (e.g. Windows Forms Application) and add a button in your form
Go to your project references and add AutoitX Library
Now go to your form and add a button
Go to codes section and fill in sample code below to create a button that will launch notepad.exe then enter text into it and finally close notepad as a demo.
 
Now test your program, you will see the exciting result
 
Q.Whats the point of using Autoit in VB.NET ?
A.As you know Autoit is single threaded, but when you use it in another language like VB.NET you can use all .NET API's combine Autoit functions with Multi threading support,using microsoft visual form designer and ... (a lot of others!)
 
Imports AutoItX3Lib

Public Class MainForm
    Dim AutoitCommand As New AutoItX3

    Private Sub StartButton_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles StartButton.Click
   AutoitCommand.Run("notepad.exe")
       AutoitCommand.WinWait("Untitled - Notepad")
       AutoitCommand.Send("This text sent to notepad by autoit functions{ENTER}Have Fun")
       AutoitCommand.Sleep(1000)
       AutoitCommand.WinKill("Untitled - Notepad")
       End
    End Sub
End Class

AutoItX3_x86.rar

AutoItX3_x64.rar

Link to comment
Share on other sites

  • 2 weeks later...

Hi 

daluu, Although the code above is not working for me, but i was shocked because, this is what i wanted. Thanks a lot.  I have tested lot of other functions. All are working. except this. May be my notepad is the problem. And i can only see a few autoit functions in vb.net. Where are the others ?. Please tell me that what should i do with AutoItX3_x86.rar file. 
Spoiler

My Contributions

Glance GUI Library - A gui library based on Windows api functions. Written in Nim programming language.

UDF Link Viewer   --- A tool to visit the links of some most important UDFs 

 Includer_2  ----- A tool to type the #include statement automatically 

 Digits To Date  ----- date from 3 integer values

PrintList ----- prints arrays into console for testing.

 Alert  ------ An alternative for MsgBox 

 MousePosition ------- A simple tooltip display of mouse position

GRM Helper -------- A littile tool to help writing code with GUIRegisterMsg function

Access_UDF  -------- An UDF for working with access database files. (.*accdb only)

 

Link to comment
Share on other sites

Hi 

daluu

Please tell me how to tie up this AutoitX with Python.

Spoiler

My Contributions

Glance GUI Library - A gui library based on Windows api functions. Written in Nim programming language.

UDF Link Viewer   --- A tool to visit the links of some most important UDFs 

 Includer_2  ----- A tool to type the #include statement automatically 

 Digits To Date  ----- date from 3 integer values

PrintList ----- prints arrays into console for testing.

 Alert  ------ An alternative for MsgBox 

 MousePosition ------- A simple tooltip display of mouse position

GRM Helper -------- A littile tool to help writing code with GUIRegisterMsg function

Access_UDF  -------- An UDF for working with access database files. (.*accdb only)

 

Link to comment
Share on other sites

Hi daluu, 

I am almost there, but i need ProgID or CLSID of autoitX3. How to find it

Spoiler

My Contributions

Glance GUI Library - A gui library based on Windows api functions. Written in Nim programming language.

UDF Link Viewer   --- A tool to visit the links of some most important UDFs 

 Includer_2  ----- A tool to type the #include statement automatically 

 Digits To Date  ----- date from 3 integer values

PrintList ----- prints arrays into console for testing.

 Alert  ------ An alternative for MsgBox 

 MousePosition ------- A simple tooltip display of mouse position

GRM Helper -------- A littile tool to help writing code with GUIRegisterMsg function

Access_UDF  -------- An UDF for working with access database files. (.*accdb only)

 

Link to comment
Share on other sites

Hi daluu,

It worked. Thanks a lot. An artcle in that link says that every info about COM in python is in Oreilly's Python Programming on Win32

by Mark Hammond. I have that book. After reading that chapter, i can easily connect AutoIt COM in python. Thanks a lot.

Spoiler

My Contributions

Glance GUI Library - A gui library based on Windows api functions. Written in Nim programming language.

UDF Link Viewer   --- A tool to visit the links of some most important UDFs 

 Includer_2  ----- A tool to type the #include statement automatically 

 Digits To Date  ----- date from 3 integer values

PrintList ----- prints arrays into console for testing.

 Alert  ------ An alternative for MsgBox 

 MousePosition ------- A simple tooltip display of mouse position

GRM Helper -------- A littile tool to help writing code with GUIRegisterMsg function

Access_UDF  -------- An UDF for working with access database files. (.*accdb only)

 

Link to comment
Share on other sites

  • 5 months later...
  • 2 years later...

AutoKMS is a program used to crack Windows... Not related to this thread I guess...

Edited by TheDcoder

EasyCodeIt - A cross-platform AutoIt implementation - Fund the development! (GitHub will double your donations for a limited time)

DcodingTheWeb Forum - Follow for updates and Join for discussion

Link to comment
Share on other sites

AutoIt is known for false positives, but I don't think it would be flagged as AutoKMS, you can click on "Show Details" and look at the location of the file, can you confirm that it is indeed the library?

EasyCodeIt - A cross-platform AutoIt implementation - Fund the development! (GitHub will double your donations for a limited time)

DcodingTheWeb Forum - Follow for updates and Join for discussion

Link to comment
Share on other sites

18 minutes ago, TheDcoder said:

AutoIt is known for false positives, but I don't think it would be flagged as AutoKMS, you can click on "Show Details" and look at the location of the file, can you confirm that it is indeed the library?

so theres nothing for me to be worried about?

Yes it is the dll file attached in the main post triggered my anti virus

My windows defender identified it as Trojan.Win32/spursint.F!cl

Anyway i went to my autoit folder and found AutoItX3.dll under AutoitX, its pretty much the same thing am i right? I can import that as reference into my visual studio?

Link to comment
Share on other sites

11 minutes ago, cyxstudio said:

My windows defender identified it as Trojan.Win32/spursint.F!cl

Well, it is different from the AutoKMS detection from your screenshot.

 

EasyCodeIt - A cross-platform AutoIt implementation - Fund the development! (GitHub will double your donations for a limited time)

DcodingTheWeb Forum - Follow for updates and Join for discussion

Link to comment
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
 Share

×
×
  • Create New...