Jump to content

Recommended Posts

Posted (edited)

Good day.

I've been having some difficulties getting going with AutoItX.

What I am trying to do is to use AutoItX within PowerShell to automate some difficult GUI interactions in an application I have.

I am not trying to execute AU scripts but rather wish to programmatically call AutoItX function call inside a powershell script.

So far all documentation I have found shows the exact same:

1. Register the correct AutoItX DLL (by arch)

2. Create a "New-Object" and

3. Call the method needed.

And so far all the code samples I have found look the same,(e.g:This should simply launch an instance of notepad.)

<code>

$AutoIt = New-Object -ComObject AutoItX3.Control
$result = $AutoIt.Run("notepad.exe")

</code>

The problem is that this ".Control" is not available (though a "Control.Tasksymbol" is seen"

So my questions are:

1. How can I determine that the DLL is indeed registered in Windows?

2. What is the correct way to "make available" to powershell, the contained methods of AutoItX ?

3. Should/ should not ".Control" show up in the intellisense/autocomplete?

Thanks!

M.

Edited by MarcZ
  • 2 months later...
  • Administrators
Posted

Yes, use the PowerShell interface, not the COM one - this handles all the x86/x64 problems automagically.  Just open PS, browse to the AutoItX folder and then do:

    # Import the module manfiest

    Import-Module .AutoItX3.psd1

    # Get the list of AutoItX cmdlets

    Get-Command *AU3*

    # Get detailed help for a particular cmdlet

    Get-Help Get-AU3WinText


 

Posted (edited)

@MarkZ

Quick PS Example

CLS
# Import the module manfiest
Import-Module (${Env:ProgramFiles(x86)} + "\AutoIt3\Beta\AutoItX\AutoItX3.psd1")
I
nvoke-AU3Run("Notepad")

Wait-AU3WinActive("Untitled")

Send-AU3Key("I'm in notepad");

$winHandle = Get-AU3WinHandle("Untitled");

Sleep -Seconds 2

Close-AU3Win($winHandle)

# Get the list of AutoItX cmdlets
Get-Command *AU3*

# Get detailed help for a particular cmdlet
# Get-Help Get-AU3WinText
 

Rgds
ptrex

Edited by ptrex
  • Administrators
Posted

For info as well, in the current betas i'm registering the path in PSModulePath so import should work without having to specify the path :)


 

Posted
  • Administrators
Posted

It's renamed to AutoItX.psd1 in the beta. (For the auto import to work the psd file must be named the same as the parent folder which is "autoitx")


 

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
  • Recently Browsing   0 members

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