Jump to content

Call AutoItX Directly (VB 2010)


AC130
 Share

Recommended Posts

Is it possible to call AutoItX dll directly into my application? I plan on having my program on multiple computers, and I don't want to have to register it for every computer.

So is there a way to just use the functions of AutoItX? I don't want to have to make an installer either. I just wany my single .EXE file with all my AI functions.

Thanks!

Link to comment
Share on other sites

  • 4 months later...

AutoItX3.dll math with vb.net. you try.

My Sample Script

Download: VistaDesktopIconsChangerForXp.au3 (Com,Doc and Bin only) http://www.4shared.com/rar/NMHYL5Igba/VistaDesktopIconsChangerForXp_.html

                     VistaDesktopIconsChangerForXp.exe (Resources) http://www.4shared.com/rar/nzs7Mb1gba/VistaDesktopIconsChangerForXp_.html

Link to comment
Share on other sites

  • 1 month later...

Just "add reference" to the AutoitX.dll and set Embed Interop Types" to FALSE (see properties tab in references). This worked ok for me.

In the class where you want to use AutoIt functionality (C# code):

AutoItX3Lib.AutoItX3Class au3 = new AutoItX3Lib.AutoItX3Class();

au3.AutoItSetOption("WinTitleMatchMode", 2);

au3.WinWaitActive(windowName, "", maxTimeInSec)

...

Link to comment
Share on other sites

Just "add reference" to the AutoitX.dll and set Embed Interop Types" to FALSE (see properties tab in references). This worked ok for me.

In the class where you want to use AutoIt functionality (C# code):

AutoItX3Lib.AutoItX3Class au3 = new AutoItX3Lib.AutoItX3Class();

au3.AutoItSetOption("WinTitleMatchMode", 2);

au3.WinWaitActive(windowName, "", maxTimeInSec)

...

Do I have to register it on the host computer first and then do that? Because, when I try to add a reference without registering, I receive error, "A Reference To AutoItX3_X64.dll could not be added. Please make sure that the file is accessible..."

Please get back to me ASAP. :) Thanks!

Link to comment
Share on other sites

I did not need to register on the host computer (XP). I did not test on 64bit however, only on Win7 32 and on XP. Both worked without any problems (Win 7 pc has however AutoIt editor installed)

Link to comment
Share on other sites

I you are using the COM method, you will need to register it.

If you are using directly, the dll, you do not have to register it

In either case, it must be linked properly from within your IDE.

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...

Forgot to mention, but as JohnOne said, I am using the DLL directly from the lib folder in my solution.

Yes, but I don't see a "lib" folder and the only way to add a DLL to VS is to add it as a reference. In which case, I have to register it. I don't understand...

Link to comment
Share on other sites

Well, I didn't touched VB at all and I'm not familiar with its syntax, but a working example of this in C++ should be like this:

typedef long (WINAPI *MouseMoveProc)(long nX, long nY, long nSpeed);

int _tmain(int argc, _TCHAR* argv[])
{
HMODULE hModule = LoadLibrary("AutoItX3.dll");
if (hModule == NULL)
{
MessageBox(NULL, "Error 1", "", MB_OK);
return 0;
}
MouseMoveProc MouseMove = (MouseMoveProc)GetProcAddress(hModule, "AU3_MouseMove");
if (MouseMove == NULL)
{
MessageBox(NULL, "Error 2", "", MB_OK);
return 0;
}
MouseMove(10, 10, 0);
return 0;
}
Edited by D4RKON3
Link to comment
Share on other sites

  • 1 month later...

AC130, did you resolve this with the API for VB.NET as you mention in your last post? In other words, are you now able to call AutoIT commands directly in your Visual Basic solution? If so, do you mind sharing this? I am basically in the exact situation you were in when you started this discussion. However, I am fairly new to this & need a lot of guidance right now.

I am trying to create an VB application that use mostly AutoIT commands & am unsure of how exactly to begin.

Any help you can offer would be much appreciated.

Thanks a ton! :bye:

Link to comment
Share on other sites

  • 4 weeks later...

Dowload: AutoItX3Dll Auto Register AutoRegisterAutoItX3Dll: Click here

Automatic install dll file to system32 directory and registering dll to use.

You'll see dll lib add in the reference com. You must Import Class lip on the class form.

Example: VB.NET run calculator application.

Imports AutoItX3Lib
Public Class Form1
Private oAutoItX As New AutoItX3
Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click
     oAutoItX.Run("calc.exe")
End Sub
End Class
Edited by Laymanball

My Sample Script

Download: VistaDesktopIconsChangerForXp.au3 (Com,Doc and Bin only) http://www.4shared.com/rar/NMHYL5Igba/VistaDesktopIconsChangerForXp_.html

                     VistaDesktopIconsChangerForXp.exe (Resources) http://www.4shared.com/rar/nzs7Mb1gba/VistaDesktopIconsChangerForXp_.html

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

  • Recently Browsing   0 members

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