Jump to content

This site uses cookies. By continuing to browse the site you are agreeing to our use of cookies. Find out more here. X
X


Photo

Call AutoItX Directly (VB 2010)


  • Please log in to reply
16 replies to this topic

#1 AC130

AC130

    Adventurer

  • Active Members
  • PipPip
  • 143 posts

Posted 27 December 2011 - 03:07 AM

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!







#2 Richard Robertson

Richard Robertson

    Universalist

  • Active Members
  • PipPipPipPipPipPip
  • 10,329 posts

Posted 27 December 2011 - 10:25 AM

You will need to include the dll file. You don't have to register it if you call it like a dll instead of a COM object.

#3 AC130

AC130

    Adventurer

  • Active Members
  • PipPip
  • 143 posts

Posted 27 December 2011 - 09:27 PM

Do you know how to do it in VB?

#4 Richard Robertson

Richard Robertson

    Universalist

  • Active Members
  • PipPipPipPipPipPip
  • 10,329 posts

Posted 27 December 2011 - 11:29 PM

No. I haven't touched VB in a very long time.

#5 Laymanball

Laymanball

    Wayfarer

  • Active Members
  • Pip
  • 72 posts

Posted 17 May 2012 - 03:00 PM

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

#6 WimH

WimH

    Seeker

  • Normal Members
  • 6 posts

Posted 12 July 2012 - 08:31 PM

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

#7 AC130

AC130

    Adventurer

  • Active Members
  • PipPip
  • 143 posts

Posted 15 July 2012 - 07:25 PM

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!

#8 WimH

WimH

    Seeker

  • Normal Members
  • 6 posts

Posted 19 July 2012 - 07:47 PM

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)

#9 JohnOne

JohnOne

    John

  • Active Members
  • PipPipPipPipPipPip
  • 12,898 posts

Posted 20 July 2012 - 07:29 AM

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
 
 
OMG! Women are the cows of people.


#10 WimH

WimH

    Seeker

  • Normal Members
  • 6 posts

Posted 22 July 2012 - 06:40 PM

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

#11 AC130

AC130

    Adventurer

  • Active Members
  • PipPip
  • 143 posts

Posted 10 August 2012 - 06:54 PM

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

#12 FaridAgl

FaridAgl

    Universalist

  • Active Members
  • PipPipPipPipPipPip
  • 719 posts

Posted 10 August 2012 - 08:19 PM

A simple way is using LoadLibrary and GetProcAddress.

I felt in love with AutoItObject [and the new Map type!].


#13 AC130

AC130

    Adventurer

  • Active Members
  • PipPip
  • 143 posts

Posted 10 August 2012 - 08:34 PM

A simple way is using LoadLibrary and GetProcAddress.


Well, that sounds good. I'm familiar with API. Can I follow this guide?

http://www.omegajunior.net/code/vbnet_unmanaged.html

It seems like it should work, but I would like to make sure before I spend countless hours on something that won't work.

#14 FaridAgl

FaridAgl

    Universalist

  • Active Members
  • PipPipPipPipPipPip
  • 719 posts

Posted 11 August 2012 - 03:54 PM

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, 11 August 2012 - 03:55 PM.

I felt in love with AutoItObject [and the new Map type!].


#15 AC130

AC130

    Adventurer

  • Active Members
  • PipPip
  • 143 posts

Posted 12 August 2012 - 02:20 AM

Thank you. It looks promising. I've already found all the API for VB.NET and am trying to load the functions now. I'll post back with my results.

Thank you, again. :)

#16 texasranger

texasranger

    Seeker

  • New Members
  • 1 posts

Posted 26 September 2012 - 12:45 AM

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:

#17 Laymanball

Laymanball

    Wayfarer

  • Active Members
  • Pip
  • 72 posts

Posted 23 October 2012 - 11:13 AM

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, 23 October 2012 - 11:44 AM.





0 user(s) are reading this topic

0 members, 0 guests, 0 anonymous users