Sign in to follow this  
Followers 0
AutoitMike

Using autoit dll within vba

8 posts in this topic

I have done extensive programming in vb vba and autoit. Currently, I have a fairly complex application using word, autoit compiled exe's and vba. Various functions in my application shell to dos and run various autoit scripts that have been compiled into 'exe's. Calling a function in the autoitx dll has to be faster and cleaner.

I have been just told in the autoit forum about autoitx.

If I could just see sample code for autoitx and how to call it from vba I think I can run with it and figure out everything I need to do.

Let's say I want autoitx to get the name of a window to activate (from vba) and use "WinActivate" to activate it.

Thanks mucho

Share this post


Link to post
Share on other sites



#2 ·  Posted (edited)

I have done extensive programming in vb vba and autoit. Currently, I have a fairly complex application using word, autoit compiled exe's and vba. Various functions in my application shell to dos and run various autoit scripts that have been compiled into 'exe's.

That's quite the CV, if only it included a five minute lesson on searching forums, you'd have started your scripting by now.

:)

Just done a quick search for VBA, and scores of threads popped up.

is just one of them to get you started.

Edited by JohnOne

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

Monkey's are, like, natures humans.

Share this post


Link to post
Share on other sites

Johnone,

I did that too, and the only hit is this thread, there are no others.

I just would like information on the basics, the "abc's" on just how to do this.

Any thread found does not show the entire process, just an extremely "zoomed" view to just one particular problem that someone is encountering.

When I found out about autoit I Started the code editor and then opened up the help interface. There I found all of the building blocks for autoit and information on how to run scripts .

I would like to see the same for autoitX.

Share this post


Link to post
Share on other sites

I am desperately trying to figure out how to use the autoit dll functions.

So far i see that you need to dimension a variable , eg: Dim AutoIt As New AutoItX3Lib.AutoItX3

So doing that, how do I utilize the functions in the dll?

Would autoit.winactivate("Internet explorer","text in the window") activate Internet explorer??

If this is not correct , please let me know how.

Thanks

Share this post


Link to post
Share on other sites

When I execute :

Dim AutoIt As New AutoItX3Lib.AutoItX3

I encounter "User defined type not defined"

Dont I need to

Private Declare function {something} Lib Autoitx3.dll ({something as SomeType) as {someType}

Thanks

Share this post


Link to post
Share on other sites

#6 ·  Posted (edited)

So

C:\Program Files\AutoIt3\AutoItX\ActiveXVBScript

is no help at all?

I have no idea about visual basic, but just assumed with your extensive work with it

you might have know how to initialize a com object.

Edited by JohnOne

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

Monkey's are, like, natures humans.

Share this post


Link to post
Share on other sites

Topics merged, do not create multiple topics on the same question/subject.

Only verbal warning you'll get.

As far as your issue. John makes a very valid point.

1. Do you know how to create an object in VBA?

2. Did you look at the AutoItX.dll library calls in the AutoItX.chm ( found in the ..AutoIt3AutoItX directory )?

3. You ask questions like: "Will this work?" ... well, most of us use AutoIt directly, with zero need for something like VBA, we don't know, does it?

4. If something is not working, reference what you've done to try to make it work ( exact code ), reference where you got your idea from the AutoItX.chm, then ask your well thought out, specific to issue having, question.


Common sense plays a role in the basics of understanding AutoIt... If you're lacking in that, do us all a favor, and step away from the computer.

Share this post


Link to post
Share on other sites

Using AutoitX.dll in the vb.net

Register dll file in the system directory (c:windiwssystem32).

Dll file will auto add into the reference objectcom vb.net solusion.

2ways in the writting code is reference dll and using scriptting host


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

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  
Followers 0

  • Similar Content

    • 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.
      Thanks
       
    • MITH
      By MITH
      Hi,
      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
      Hi,
      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
      Hi,
      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!
    • Jewtus
      By Jewtus
      I'm trying to create a simple outlook function that validates the email addresses before sending. I'm trying adapt this script:
      https://msdn.microsoft.com/EN-US/library/office/ff867165.aspx
       
      Func SendEmails() $olApp = ObjCreate("Outlook.Application") $olMailItem = 0 $objMail = $olApp.CreateItem($olMailItem) With $objMail .Save .Subject = ("TEST") .Display $oRecipients=.Recipients EndWith With $oRecipients .Add("User1") .Add("User2") If not .ResolveAll Then For $z In $oRecipients If not .Resolved then MsgBox(0,"",.Name) Next EndIf EndWith EndFunc I'm only trying to capture the message box because the resolveall function doesn't seem to be doing anything. I tried using the above script and it works up to the resolveall statement but it doesn't seem to do anything. I was hoping putting the message box in would help me figure out what is going on, but I'm getting errors on .Resolved.
       
      Anyone used the Resolveall function before?