Jump to content
Sign in to follow this  
Jon

AutoItX Beta (COM / PowerShell / C#)

Recommended Posts

Jon

Usage

COM / Native DLL Imports

As per help file.

C#

Add a reference to "AutoItX3.Assembly.dll" to your .NET project.

Add "using AutoIt;"

Use the wrappers AutoItX.FunctionName

You'll need "AutoItX3.Assembly.dll" and "AutoItX3.dll" in the same folder as your .exe.

PowerShell

Import-Module .\AutoItX3.psd1

Get-Command *AU3*

Get-Help Get-AU3WinText

Share this post


Link to post
Share on other sites
Jon

Currently Complete Commands

These are the currently complete PowerShell CmdLets (and by extension, the C# wrappers)

CommandType     Name                                               ModuleName
-----------     ----                                               ----------
Cmdlet          Assert-AU3IsAdmin                                  AutoItX3
Cmdlet          Assert-AU3WinActive                                AutoItX3
Cmdlet          Assert-AU3WinExists                                AutoItX3
Cmdlet          Close-AU3Win                                       AutoItX3
Cmdlet          Get-AU3Clip                                        AutoItX3
Cmdlet          Get-AU3ControlHandle                               AutoItX3
Cmdlet          Get-AU3ControlPos                                  AutoItX3
Cmdlet          Get-AU3ErrorCode                                   AutoItX3
Cmdlet          Get-AU3MousePos                                    AutoItX3
Cmdlet          Get-AU3StatusbarText                               AutoItX3
Cmdlet          Get-AU3WinCaretPos                                 AutoItX3
Cmdlet          Get-AU3WinClassList                                AutoItX3
Cmdlet          Get-AU3WinClientSize                               AutoItX3
Cmdlet          Get-AU3WinHandle                                   AutoItX3
Cmdlet          Get-AU3WinPos                                      AutoItX3
Cmdlet          Get-AU3WinProcess                                  AutoItX3
Cmdlet          Get-AU3WinState                                    AutoItX3
Cmdlet          Get-AU3WinText                                     AutoItX3
Cmdlet          Get-AU3WinTitle                                    AutoItX3
Cmdlet          Initialize-AU3                                     AutoItX3
Cmdlet          Invoke-AU3Run                                      AutoItX3
Cmdlet          Invoke-AU3RunAs                                    AutoItX3
Cmdlet          Invoke-AU3RunAsWait                                AutoItX3
Cmdlet          Invoke-AU3RunWait                                  AutoItX3
Cmdlet          Invoke-AU3Shutdown                                 AutoItX3
Cmdlet          Move-AU3Win                                        AutoItX3
Cmdlet          Send-AU3Key                                        AutoItX3
Cmdlet          Set-AU3Clip                                        AutoItX3
Cmdlet          Set-AU3Option                                      AutoItX3
Cmdlet          Set-AU3WinOnTop                                    AutoItX3
Cmdlet          Set-AU3WinState                                    AutoItX3
Cmdlet          Set-AU3WinTitle                                    AutoItX3
Cmdlet          Set-AU3WinTrans                                    AutoItX3
Cmdlet          Show-AU3WinActivate                                AutoItX3
Cmdlet          Show-AU3WinMinimizeAll                             AutoItX3
Cmdlet          Show-AU3WinMinimizeAllUndo                         AutoItX3
Cmdlet          Wait-AU3Win                                        AutoItX3
Cmdlet          Wait-AU3WinActive                                  AutoItX3
Cmdlet          Wait-AU3WinClose                                   AutoItX3
Cmdlet          Wait-AU3WinNotActive                               AutoItX3

Share this post


Link to post
Share on other sites
Jon

Updated the download.

Changes since last full AutoIt beta:

- Added: AutoItX3_DLL.cs - a C# wrapper for the DLL (in progress).
- Added: DLL Import: AU3_WinGetPos.
- Added: DLL Import: AU3_ControlGetPos.
- Added: DLL Import: AU3_MouseGetPos.
- Added: DLL Import: AU3_WinGetClientSize.
- Added: DLL Import: AU3_WinGetCaretPos.
- Removed: DLL Imports: AU3_WinGetPosX, AU3_WinGetPosY, AU3_WinGetPosWidth, AU3_WinGetPosHeight.
- Removed: DLL Imports: AU3_ControlGetPosX, AU3_ControlGetPosY, AU3_ControlGetPosWidth, AU3_ControlGetPosHeight.
- Removed: DLL Imports: AU3_MousePosX, AU3_MouseGetPosY
- Removed: DLL Imports: AU3_WinGetClientSizeWidth, AU3_WinGetClientSizeHeight.
- Removed: DLL Imports: AU3_WinGetCaretPosX, AU3_WinGetCaretPosY.
- Removed: DLL Imports: AU3_CDTray, AU3_BlockInput.
- Removed: COM Methods: CDTray, BlockInput. 
- Removed: All registry functions. The support was limited and the host language will certainly have registry functions.
- Removed: All Ini file functions. As per registry functions.

Share this post


Link to post
Share on other sites
Jon

I've updated the download.

I've completed the C# wrapper part so there are now friendly wrapper functions for all the DLL Imports.  As part of that, instead of supplying a .cs file I've simply compiled it into a CLR 2.0 Assembly that you can just add as a reference to any .NET aware application (Or of course, Visual Studio C# VB, etc).

The Assembly files are:

AutoItX3.Assembly.dll

AutoItX3.Assembly.xml

The .xml file is a very sparse documentation/intellisense file. But it's better than nothing :)

The PowerShell cmdlets file has been renamed to AutoItX3.PowerShell.dll (which is turn uses the AutoItX3.Assembly.dll). This is imported using the new manifest file AutoItX3.psd1.

Using the Assembly from VB/C# is very easy:

- Add a reference to "AutoItX3.Assembly.dll" to your project

- Add a "using AutoIt;" statement in the files you want to use AutoIt functions

- Write code like this:

using AutoIt;
...

// No way, this is C#

AutoItX.Run("notepad.exe");
AutoItX.WinWaitActive("Untitled");
AutoItX.Send("I'm in notepad");
IntPtr winHandle = AutoItX.WinGetHandle("Untitled");
AutoItX.WinKill(winHandle);

Next step is to finish off adding the PowerShell cmdlets for the useful functions and then after that I can see if there are any new functions from AutoIt that should be added.

Share this post


Link to post
Share on other sites
Kyokoshin

wow nice work. Can you add the Tooltip Funktion pls?

Share this post


Link to post
Share on other sites
BrewManNH

You can do the ToolTip functions directly from C/C++/<insert language of choice> take a look at the GUIToolTip.au3 file that comes with AutoIt to see how it's done in there. 


If I posted any code, assume that code was written using the latest release version unless stated otherwise. Also, if it doesn't work on XP I can't help with that because I don't have access to XP, and I'm not going to.
Give a programmer the correct code and he can do his work for a day. Teach a programmer to debug and he can do his work for a lifetime - by Chirag Gude
How to ask questions the smart way!

I hereby grant any person the right to use any code I post, that I am the original author of, on the autoitscript.com forums, unless I've specifically stated otherwise in the code or the thread post. If you do use my code all I ask, as a courtesy, is to make note of where you got it from.

Back up and restore Windows user files _Array.au3 - Modified array functions that include support for 2D arrays.  -  ColorChooser - An add-on for SciTE that pops up a color dialog so you can select and paste a color code into a script.  -  Customizable Splashscreen GUI w/Progress Bar - Create a custom "splash screen" GUI with a progress bar and custom label.  -  _FileGetProperty - Retrieve the properties of a file  -  SciTE Toolbar - A toolbar demo for use with the SciTE editor  -  GUIRegisterMsg demo - Demo script to show how to use the Windows messages to interact with controls and your GUI.  -   Latin Square password generator

Share this post


Link to post
Share on other sites
Kyokoshin

hmm but i need a gloabl tooltip, not the gui-version.

and i cant find a good solution that works like the au3.tooltip. :/

Share this post


Link to post
Share on other sites
BrewManNH

Not even sure what that means. The tooltips in the GUIToolTip UDF are created using the CreateWindowExW function from user32.dll, you don't need a GUI to use them. You don't even need AutoIt, which was my first point.


If I posted any code, assume that code was written using the latest release version unless stated otherwise. Also, if it doesn't work on XP I can't help with that because I don't have access to XP, and I'm not going to.
Give a programmer the correct code and he can do his work for a day. Teach a programmer to debug and he can do his work for a lifetime - by Chirag Gude
How to ask questions the smart way!

I hereby grant any person the right to use any code I post, that I am the original author of, on the autoitscript.com forums, unless I've specifically stated otherwise in the code or the thread post. If you do use my code all I ask, as a courtesy, is to make note of where you got it from.

Back up and restore Windows user files _Array.au3 - Modified array functions that include support for 2D arrays.  -  ColorChooser - An add-on for SciTE that pops up a color dialog so you can select and paste a color code into a script.  -  Customizable Splashscreen GUI w/Progress Bar - Create a custom "splash screen" GUI with a progress bar and custom label.  -  _FileGetProperty - Retrieve the properties of a file  -  SciTE Toolbar - A toolbar demo for use with the SciTE editor  -  GUIRegisterMsg demo - Demo script to show how to use the Windows messages to interact with controls and your GUI.  -   Latin Square password generator

Share this post


Link to post
Share on other sites
MrGadget

Looking for HotKeySet...is it there under another name?

Share this post


Link to post
Share on other sites
Richard Robertson

Looking for HotKeySet...is it there under another name?

You can't set hot keys in the dll as you need a window handle to receive the events. Use the tools provided by your target language to do this instead.

Share this post


Link to post
Share on other sites
Guest
This topic is now closed to further replies.
Sign in to follow this  

×