Jump to content
Sign in to follow this  

Using AutoitX3 dll

Recommended Posts


This is what is needed to use AutoItX3 Dll in Word VBA

1. Check the checkbox in references for Autoit type Lib

2. Diminsion a variable to use as the parent for all AutoIt functions. EG:

Dim AutoIt As New AutoItX3Lib.AutoItX3

3. Type the parent name followed by a dot. You will right away see a drop down list of Autoit functions.

4. Select the function needed.

The syntax is different in VBA for word. EG:

In the Scite editor you would use the WinActivate like so:

WinActivate("My Window", "Text in the window")

In VBA for Word (and all other office products probably) you use:

AutoIt.WinActivate "My Window", "Text in the window" 'No parens

Otherwise "Expected Function or Variable" is encountered.

My only question now is why is the list of functions in the drop down only a small subset of the bizillion functions that exit in Autoit.

Edited by AutoitMike

Share this post

Link to post
Share on other sites

Which leads me back to my original post.

I always notice a lag of time when my vba application runs my autoit executable for the first time. Wouldn't a dll load and run much faster?

I have noticed using autoitX from my vba application is instantaneous. Compiling to a loadable dll seems to be a viable function??

Share this post

Link to post
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
Sign in to follow this  

  • Similar Content

    • nooneclose
      By nooneclose
      How do I properly convert this to Autoit? This is a VBA macro that I recorded in Excel.
       ActiveSheet.Outline.ShowLevels RowLevels:=2 I need this to close my subtotal once it is finished. 
      any help will be greatly appreciated. 
    • afzalw
      By afzalw
      I am using Autoit to automate another software.  I am looking to create a piece of code which can select the option from a combo box.  I know what option I want to select and I have stored it in a string but nothing seems to be working for me. 
      I am able to click on the Control by using this code.
      ControlClick("Import/Export Table Name", "","[NAME:cmbTableName]"); This is what I was thinking but doesn't work for me.
      ControlCommand("Import/Export Table Name", "", "[NAME:cmbTableName]", "SelectString", $MyOptionName)  
      If it helps: The option name that I want to select is also stored in clipboard.
      Any comments on what am I missing here will be appreciated.
    • MITH
      By MITH
      I am trying to use ControlMove function AU3 DLL in VBA. The function instead of moving the control just makes it disappear. It only appears when I resize notepad manually.
      Can anybody please help me and let me know whats the miss here
      Here's the code I am working on:
      Private Declare PtrSafe Function AU3_ControlMove Lib "C:\Program Files\AutoIt3\AutoItX\AutoItX3.dll" (ByVal szTitle As LongPtr, ByVal szText As LongPtr, ByVal szControl As LongPtr, ByVal nX As Integer, ByVal nY As Integer, nWidth As Integer, nHeight As Integer) As Long Private Function ControlMove(szTitle As String, szControl As String, nX As Integer, nY As Integer, Optional nWidth As Integer = -1, Optional nHeight As Integer = -1, Optional szText As String = "") As Long ControlMove = AU3_ControlMove(StrPtr(szTitle), StrPtr(szText), StrPtr(szControl), nX, nY, nWidth, nHeight) End Function Sub test() ControlMove "Untitled - Notepad", "[CLASS:Edit; INSTANCE:1]", 0, 0, 150, 150 End Sub The Edit Box in Notepad just disappears.
    • RamPalav
      By RamPalav
      I want to send text into a VBA form's text field. Can someone please guide me on the autoit script that can help me.
      Below is the sample code that I need help on:
      #include <Excel.au3> #include <FileConstants.au3> #include <MsgBoxConstants.au3> @ScriptDir ="D:\\AutoIT\" $sFilePath = @ScriptDir & "\ExcelForm.xlsm" Local $oAppl = _Excel_Open() ;Local $oAppl = _Excel_Open(False, Default, Default, Default, True) Local $sWorkbook = $sFilePath Local $oWorkbook = _Excel_BookOpen($oAppl, $sWorkbook) ConsoleWrite('before opening macro.........1') $oAppl.Run('mymacro') Sleep(3000) ConsoleWrite('After opening macro.........1') Send('First text') ConsoleWrite('After opening macro.........2') Send('{TAB}') ConsoleWrite('After opening macro.........3') Send('Second text') ConsoleWrite('After opening macro.........4') Send('{TAB}') Send('{Enter}') ConsoleWrite('After opening macro.........5') thanks,
    • exodius
      By exodius
      Can someone help me with how to translate this correctly? I've been working on it for a few hours and I just can't quite get it right.
      Columns("G:G").Select Selection.FormatConditions.Add Type:=xlCellValue, Operator:=xlEqual, _ Formula1:="=""Purchase""" Selection.FormatConditions(Selection.FormatConditions.Count).SetFirstPriority With Selection.FormatConditions(1).Font .Color = -16383844 .TintAndShade = 0 End With With Selection.FormatConditions(1).Interior .PatternColorIndex = xlAutomatic .Color = 13551615 .TintAndShade = 0 End With Selection.FormatConditions(1).StopIfTrue = False I think I'll be fine after the .Add line, I just cannot get it to work. Here's what I've been trying:
      $oExcel.Selection.FormatConditions.Add(9, 3, "=""Purchase""", '') ;Type:=xlCellValue, Operator:=xlEqual, Formula1:="=""Purchase""" Any help is definitely appreciated!