Jump to content

Search the Community

Showing results for tags 'autoitx'.



More search options

  • Search By Tags

    Type tags separated by commas.
  • Search By Author

Content Type


Forums

  • General
    • Announcements and Site News
    • Administration
  • AutoIt v3
    • AutoIt Help and Support
    • AutoIt Technical Discussion
    • AutoIt Example Scripts
  • Scripting and Development
    • Developer General Discussion
    • Language Specific Discussion
  • IT Administration
    • Operating System Deployment
    • Windows Client
    • Windows Server
    • Office

Categories

  • AutoIt Team
    • Beta
    • MVP
  • AutoIt
    • Automation
    • Databases and web connections
    • Data compression
    • Encryption and hash
    • Games
    • GUI Additions
    • Hardware
    • Information gathering
    • Internet protocol suite
    • Maths
    • Media
    • PDF
    • Security
    • Social Media and other Website API
    • Windows
  • Scripting and Development
  • IT Administration
    • Operating System Deployment
    • Windows Client
    • Windows Server
    • Office

Categories

  • Forum
  • AutoIt

Calendars

  • Community Calendar

Found 20 results

  1. Hello, I have to execute below block of code in elevated previllage, as that particular wmic class will work only with admin previlage. i am getting out put when i launch autoit as administrator, but i will not be able to launch autoit as admin in this particular case but my user have admin rights. is there any better way i can run those command as administrator.? tried below steps: i have tried #RequireAdmin but that creates a user prompt Tried using Runas command but gives error as wrong username or password , stuck with that step.
  2. Hi UPDATED Notes: =============================================================================== UPDATED: My main and second questions answered. Here the answers: To add/access WinMenuSelectItem you need to [Thanks to Fernando_Marinho]: Add AutoItX.Dotnet in Manage NuGet Packages Right Click in your Project -> Add -> Reference... -> COM ( Type Libraries )than, check the option AutoItX3 1.0 Type Library using AutoItX3Lib; AutoItX3 au3 = new AutoItX3(); au3.WinMenuSelectItem("", ...) My full source code in C# exists in 11 posts in below. How to access those overloaded methods in AutoitX3 that are not accessible via above method!? Or how to fix AutoitX3 DLL Registration need in target computers without Autoit pre-installed on them!? Please check my post at 14 posts below! =============================================================================== Original Post: I was writing a small app in Autoit to close µTorrent app. It was working. Then I try to import AutoItX into C#, but unfortunately this method WinMenuSelectItem Couldn't find by IntelliSense and If I typed completely it still give me this message: Please check the image. I Google it and I found this QA at stackoverflow: Autoit error within C# application I saw they use this line: au = new AutoItX3Lib.AutoItX3Class(); I figure it how to add 'AutoItX3Lib' to project (by adding 'AutoItX3.dll' to reference) but again! When I use this line: var au = new AutoItX3Class(); I got this error message: Interop type 'AutoItX3Class' cannot be embedded. Use the applicable interface instead. My system info: Visual Studio 2017 Enterprise - v15.5.4 X64 Windows 10 Enterprise 1607 Thanks in advanced IgImAx
  3. File Search

    Hi all, Below is my script, Pls advise me if any wrong on that....File exit in location but the return -1. FileOpen($file, 0) $line = FileReadLine($file) MsgBox(0,'',$line) FileClose($file) Local $aArray = _FileListToArrayRec($serverpath, "*|*.txt", $FLTAR_FILES, $FLTAR_RECUR, $FLTAR_SORT, $FLTAR_NOPATH) If @error Then MsgBox($MB_SYSTEMMODAL, "Ooops!", "No files found") Else ;_ArrayDisplay($aArray, "Sorted tree") Local $hSearch = FileFindFirstFile($line) MsgBox(0,'',$hSearch)
  4. I need to select an item from a SAP combobox, could anyone help me or did something like that? I tried to use some AutoIt functions but without success. When i try to identify the combobox with au3Info, this is the return: Could anyone help me with this challange?
  5. I recently tried to use ControlClick method to send a mouse click command to a button in a application, but I noticed that it is not working when I give first parameter as a window handle (HWND). But, when I give class name or window title, it works fine. I used AutoItX3 and VBScript. Following are the commands I tried in VBScript: Dim WINAPI: Set WINAPI = WScript.CreateObject("WinAPIWrapper.WINAPI") Dim AutoItX3: Set AutoItX3 = WScript.CreateObject("AutoItX3.Control") Dim WindowHandle: WindowHandle = WINAPI.WinAPI_FindWindow("my window title", "my window class") 'Window handle obtains fine by my wrapper function 'Above window handle is obtained as a hexadecimal string. (I.E. - 0x00000000) I tried it like: WScript.Echo CStr(AutoItX3.ControlClick(WindowHandle, "", "[CLASS:Button; INSTANCE:1]")) // DOES NOT WORK WScript.Echo CStr(AutoItX3.ControlClick(CLng("&h" + Replace(WindowHandle, "0x", "")), "", "[CLASS:Button; INSTANCE:1]")) // DOES NOT WORK WScript.Echo CStr(AutoItX3.ControlClick(000000, "", "[CLASS:Button; INSTANCE:1]")) // DOES NOT WORK WScript.Echo CStr(AutoItX3.ControlClick(0x00000000, "", "[CLASS:Button; INSTANCE:1]")) // DOES NOT WORK Only following commands work: WScript.Echo CStr(AutoItX3.ControlClick("[CLASS:my window class]", "", "[CLASS:Button; INSTANCE:1]")) // WORKS FINE WScript.Echo CStr(AutoItX3.ControlClick("My window title", "", "[CLASS:Button; INSTANCE:1]")) // WORKS FINE If any of your suggestions don't work, I will have to write a wrapper function myself to send mouse click commands. I chosen AutoIt V3 because it is good specially when comes to send keystrokes to applications. Please tell me why this won't work when I give window handle as first parameter. Thanks in advance.
  6. Hi Experts, I want to integrate AutoIT with Eclipse to write my code in java for automating the desktop base application, i have integrate jacob 1.18 and verify the dll's also but i am getting How to fix java.lang.UnsupportedClassVersionError: Unsupported major.minor version 51 issue. I am using 32 bit windows xp with java 1.6 version. Java 1.7 is unsupported in 32 bit windows xp. is there any solution for the same.
  7. Hi Experts, I am getting error: _ExcelBookOpen() undefined function in auto IT scite whenever i execute any program using functions. i defined the functions name also but this error is not getting resolved. _ExcelBookOpen(): undefined function _ExcelReadCell():undefined function require your inputs to fix this issue. I'm going through the forums and examples, but can't find anything and follow the suggestions but this issue hasn't got resolved.
  8. I am trying to automate the windows GUI application, in the main window of this application i have one gridview control in it, and when you click on the any row of the gridview separate windows will be opened based on the selection of the row. we have our existing framework implemented using the core java, i have used AutoITX4java.jar file to automate the above application. and controlCommandListView options used to click on grid view row item. nothing is working. my question is AutoIT can be used/called directly from java file??? instead of using the AutoITX4java.jar file??? AutoIT supports GridView automation??? like gridview count and gridivew row item click event automation ect...???? Any help would be really appricate!! Thanks Srini srini20483@gmail.com
  9. Hi experts. I'm trying to get this to work: https://www.autoitscript.com/forum/topic/173949-using-the-autoit-powershell-cmdlets/ but I get an error: error: syntax error (illegal character) "Import-Module .\" Can anyone help me?
  10. 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.
  11. AU3_PixelSearch

    I am trying to use pixel search using VBA but it is returning Bad DLL calling convention error. I don't know where this is going wrong Hoping that you may be able to help. Here's my code: Public Function PixelSearch(lX1 As Long, lY1 As Long, lX2 As Long, lY2 As Long, lColor As Long, Optional lVariations As Long = 0, Optional lStep As Long = 1) As String Dim Rect As LPRECT, szResult As String, pos As Integer 'szResult = String(255, vbNullChar) Rect.X = lX1 Rect.Y = lY1 Rect.Width = lX2 Rect.Height = lY2 'Private Declare Sub AU3_PixelSearch Lib "AutoItX3.dll" (ByRef LRECT As LPRECT, ByVal nColor As Long, ByVal nVariations As Long, ByVal nStep As Long, ByVal szResult As LongPtr, ByVal nBufSize As Long) AU3_PixelSearch Rect, lColor, lVariations, lStep, StrPtr(szResult), Len(szResult) If pos > 0 Then szResult = Left(szResult, pos - 1) End If PixelSearch = Trim(szResult) End Function
  12. Hello every body!!! I was try this code is work in AutoIt (au3) #include <MsgBoxConstants.au3> #include <GuiListView.au3> Global $hWndWindow = WinGetHandle("Form1") Global $hWndLv = ControlGetHandle($hWndWindow, "", "WindowsForms10.SysListView32.app.0.bf7771_r11_ad11") MsgBox($MB_SYSTEMMODAL, "", ControlListView($hWndWindow, "", $hWndLv, "GetItemCount")) _GUICtrlListView_ClickItem($hWndLv, 1, "left", False, 2) But now, I want to use _GUICtrlListView_ClickItem in C#. I was add reference AutoItX3.dll and AutoItX3.Assembly.dll for my project but i could not found any function which same _GUICtrlListView_ClickItem from them. Please help me
  13. NMap UDF (Beta Version)

    later , I will add more functions , please note that the main requirement is to have Nmap already installed in your machine ; ******Nmap UDF! v1.0.1******* ;Added and created by Pionner ;Chilean-Brazilian Developer ;Notice that you've nmap already installed in your machine ;In this case I dont add preventers or even error handlers, such as network connection fail or detect if nmap is already installed. #include-once #include <Array.au3> #include <StringConstants.au3> ;#include Global Const $NMAP_RAW_OUT = 0 Global Const $NMAP_ARRAY_OUT = 1 Global Const $NMAP_FILE_TXT = 2 Global Const $NMAP_FILE_XML = 3 ; #FUNCTION# ==================================================================================================================== ; Name ..........: _Nmap_SingleScan ; Description ...: Performs an scan to retrieve open ports using @comspec and child process ; Syntax ........: _Nmap_SingleScan($ip_address, $output = 0 , $dir = @ScriptDir) ; Parameters ....: $ip_address - A valid IpV4 address as string. ; $output - [optional] Select how the result will be displayed. it can be... ; $NMAP_RAW_OUT [0] - raw results with all headers into a string.(default) ; $NMAP_ARRAY_OUT[1] - a simple 2D array indicating port/protocol, status and Service ; $NMAP_FILE_TXT[2] - Save the Results to .txt file into a custom folder (default @ScriptDir) ; $NMAP_FILE_XML[3] - Save the Results to .xml file into a custom folder (default @ScriptDir) ; $dir - [optional] Set The folder to save your output file ; Return values .: success: return the results as specified above ; Author ........: Pionner ; Modified ......: ; Remarks .......: take in count that It will take several seconds to accomplish without notifications ; Related .......: ; Link ..........: ; Example .......: Yes ; =============================================================================================================================== Func _Nmap_SingleScan($ip_address, $output = 0 , $dir = @ScriptDir) Local $Raw, $ix, $pSS Dim $NwArOut[3][3] Select Case $Output = 2 $fileOuput = StringReplace($ip_address, ".", "_") & ".txt" Case $Output = 3 $fileOutput = StringReplace($ip_address, ".", "_") & ".xml --no-stylesheet" Case Else $fileOutput = "" EndSelect $ports = Run(@ComSpec & " /c nmap " & $ip_address & " " & $fileOutput , $dir , @SW_HIDE, $STDOUT_CHILD) ProcessWaitClose($ports) $ArOutcome = StdoutRead($ports) Switch $output Case 0 Return $ArOutcome Case 1 local $iw=0 $Raw = StringSplit($ArOutcome,@CRLF,$STR_ENTIRESPLIT) For $ix = 7 to $Raw[0]-3 $pSS = StringSplit(StringRegExpReplace($Raw[$ix],"\ +","|"), "|") $NwArOut[$iw][0]= $pSS[1] $NwArOut[$iw][1]= $pSS[2] $NwArOut[$iw][2]= $pSS[3] ReDim $NwArOut[$iw+2][3] $iw = $iw + 1 Next Return $NwArOut Case Else Return True EndSwitch EndFunc ; #FUNCTION# ==================================================================================================================== ; Name ..........: _Nmap_MultiScanByArray ; Description ...: Scan multiple ips at once retrieve an Array pack with results ; Syntax ........: _Nmap_MultiScanByArray($ip_array, $pipe) ; Parameters ....: $ip_pack - An Array/String. ; $pipe - The separator string (dafault is coma) ; $output - [optional] Select how the result will be displayed. it can be... ; $NMAP_RAW_OUT [0] - raw results with all headers into a string.(default) ; $NMAP_ARRAY_OUT[1] - complex 2D array 1st Col = Ip's 2nd to nth Col... port/protocol ; $NMAP_FILE_TXT[2] - Save the Results to .txt file into a custom folder (default @ScriptDir) ; $NMAP_FILE_XML[3] - Save the Results to .xml file into a custom folder (default @ScriptDir) ; $dir - the path to save the results ; Return values : a XML file with speciific Format into your @scriptdir directory ; Author ........: Your Name ; Modified ......: ; Remarks .......: ; Related .......: ; Link ..........: ; Example .......: No ; =============================================================================================================================== Func _Nmap_MultiScanByArray($ip_pack, $pipe="|", $dir = @ScriptDir) Local $ipCalc = StringReplace($ip_pack,$pipe," ") $ports = Run(@ComSpec & " /c nmap " & $ipCalc , $dir , @SW_HIDE, $STDOUT_CHILD) ProcessWaitClose($ports) $ArOutcome = StdoutRead($ports) Select Case "" Return $ArOutcome Case 1 $ver = StringSplit($ArOutcome,"" & @CRLF,$STR_ENTIRESPLIT) $lUp = _ArrayFindAll($ver,"report",0,0,0,1) Dim $OutArrMult[1][2] Dim $ips[1] For $ix=0 to UBound($lUp)-1 $ips[$ix] = StringReplace($ver[$lUp[$ix]],"Nmap scan report for ","") Local $in = ($lUp[$ix]+4) Local $iCol = 1 $OutArrMult[$ix][0] = $ips[$ix] ReDim $ips[UBound($ips)+1] While $ver[$in + $iCol] <> "" $iRow = StringSplit(StringRegExpReplace($ver[$in + $iCol],"\ +","|"),"|") $OutArrMult[$ix][$iCol] = $iRow[1] ReDim $OutArrMult[$ix+2][UBound($OutArrMult,2)+1] $iCol = $iCol + 1 WEnd Next Return $OutArrMult EndSelect EndFunc ; #FUNCTION# ==================================================================================================================== ; Name ..........: _Nmap_MultiScanByList ; Description ...: Use a .txt with a list of lots of ipv4 addresses and make it hapen! ; Syntax ........: _Nmap_MultiScanByList($file) ; Parameters ....: $file - the Full path of file that contains the ipv4 list. ; $dir - the destination fiolder ; Return values .: ; Author ........: Pionner ; Modified ......: ; Remarks .......: ; Related .......: ; Link ..........: ; Example .......: No ; =============================================================================================================================== Func _Nmap_MultiScanByList($file, $dir) $ports = Run(@ComSpec & " /c nmap -iL " & $file , $dir , @SW_HIDE, $STDOUT_CHILD) ProcessWaitClose($ports) EndFunc ; #FUNCTION# ==================================================================================================================== ; Name ..........: _Nmap_ScanByRange ; Description ...: ; Syntax ........: _Nmap_ScanByRange($ip, $range) ; Parameters ....: $ip - An integer value. ; $range - An unknown value. ; Return values .: None ; Author ........: Your Name ; Modified ......: ; Remarks .......: ; Related .......: ; Link ..........: ; Example .......: No ; =============================================================================================================================== Func _Nmap_ScanByRange($ip, $range) EndFunc ; #FUNCTION# ==================================================================================================================== ; Name ..........: _Nmap_ScanEntireSubnet ; Description ...: ; Syntax ........: _Nmap_ScanEntireSubnet($ip_loc) ; Parameters ....: ; Return values .: None ; Author ........: Your Name ; Modified ......: ; Remarks .......: ; Related .......: ; Link ..........: ; Example .......: No ; =============================================================================================================================== Func _Nmap_ScanEntireSubnet($ip_loc) EndFunc ; #FUNCTION# ==================================================================================================================== ; Name ..........: _Nmap_ScanAgressiveMode ; Description ...: Make a Agressive Scan to a Ip address (no stealth mode) ; Syntax ........: _Nmap_ScanAgressiveMode($ip_address) ; Parameters ....: $ip_address - A Valid Ipv4 address. ; Return values .: Open ports for given IP ; Author ........: Pionner ; Modified ......: ; Remarks .......: ; Related .......: ; Link ..........: ; Example .......: No ; =============================================================================================================================== Func _Nmap_ScanAgressiveMode($ip_address) EndFunc ; #FUNCTION# ==================================================================================================================== ; Name ..........: _Nmap_ScanIpv6Target ; Description ...: ; Syntax ........: _Nmap_ScanIpv6Target($ip_address) ; Parameters ....: $ip_address - A Valid Ipv6 address ; Return values .: None ; Author ........: Your Name ; Modified ......: ; Remarks .......: ; Related .......: ; Link ..........: ; Example .......: No ; =============================================================================================================================== Func _Nmap_ScanIpv6Target($ip_address) EndFunc ; #FUNCTION# ==================================================================================================================== ; Name ..........: _Nmap_ARPPing ; Description ...: Ping a host with ARP script ; Syntax ........: _Nmap_ARPPing($ip_address) ; Parameters ....: $ip_address - A valid Ipv4 address. ; Return values .: Open Ports of given ; Author ........: Your Name ; Modified ......: ; Remarks .......: ; Related .......: ; Link ..........: ; Example .......: No ; =============================================================================================================================== Func _Nmap_ARPPing($ip_address) EndFunc ; #FUNCTION# ==================================================================================================================== ; Name ..........: _Nmap_ScanFastMode ; Description ...: Scan the given Ipv4 address in Turbo mode with minimal verbosing info ; Syntax ........: _Nmap_ScanFastMode($ip_address) ; Parameters ....: $ip_address - An integer value. ; Return values .: None ; Author ........: Your Name ; Modified ......: ; Remarks .......: ; Related .......: ; Example .......: No ; =============================================================================================================================== Func _Nmap_ScanFastMode($ip_address) EndFunc ; #FUNCTION# ==================================================================================================================== ; Name ..........: _Nmap_ExecuteNSEscript ; Description ...: ; Syntax ........: _Nmap_ExecuteNSEscript($ip_address, $sname[, $sarguments = ""[, $fileoutput = ""]]) ; Parameters ....: $ip_address - An integer value. ; $sname - A string value. ; $sarguments - [optional] A string value. Default is "". ; $fileoutput - [optional] A boolean value. Default is "". ; Return values .: None ; Author ........: Your Name ; Modified ......: ; Remarks .......:list of interesting nse scripts ; nmap -sU -p 161 -T4 -d -v -n -Pn --script snmp-interfaces & ip -- get the remote MAC address ; nmap -sU -script=nbstat.nse -p137 --open 172.192.10.0/23 -oX 172.192.10.0.xml | grep MAC * | awk -F";" {'print $4'} ; Related .......: ; Link ..........: ; Example .......: Yes ; ; =============================================================================================================================== Func _Nmap_ExecuteNSEscript($ip_address, $sname,$sarguments = "", $fileoutput= "") EndFunc
  14. Good day!!! In the process of the script vbs I use as an information window function ToolTip, example: Set objAutoItTT = WScript.CreateObject("AutoItX3.Control") strTT = "Update Adress Book. " & VbLf & "#############################" & VbLf objAutoItTT.ToolTip strTT & "Preparation, checks." , 50, 50In the process of writing the script used AutoitX3.dll library version 3.3.8.1 Everything worked great. After upgrading to version 3.3.14.2 of the library, the script works, but the windows are not displayed tooltip. Help me please!!!
  15. The following files are provided to allow .NET use: AutoItX3.Assembly.dll - The .NET Assembly for using AutoItX.AutoItX3.Assembly.xml - The Visual Studio Intellisense help file for the .NET Assembly.AutoItX3.dll - The main AutoItX DLL (x86)AutoItX3_x64.dll - The main AutoItX DLL (x64)Using the Assembly from VB/C# within in Visual Studio is very easy: Add a reference to AutoItX3.Assembly.dll to your projectAdd a using AutoIt; statement in the files you want to use AutoIt functionsWrite code like this C# example:using AutoIt; ... // Wow, this is C#! AutoItX.Run("notepad.exe"); AutoItX.WinWaitActive("Untitled"); AutoItX.Send("I'm in notepad"); IntPtr winHandle = AutoItX.WinGetHandle("Untitled"); AutoItX.WinKill(winHandle);Distribute your final executable with the files AutoItX3.Assembly.dll, AutoItX3.dll, AutoItX3_x64.dll.
  16. Hi, im new to autoit and i have a little problem i have to do a app to start some web pages and some windows base programs oane of them is Skype, the problem is that Skype starts but only in system tray and i do not know how to appear on desktop the code i use is below: public static String jvmBitVersion(){ return System.getProperty("sun.arch.data.model"); } private void jButton4ActionPerformed(java.awt.event.ActionEvent evt) { String jacobDllVersionToUse; if (jvmBitVersion().contains("32")){ jacobDllVersionToUse = "jacob-1.18-M2-x86.dll"; } else { jacobDllVersionToUse = "jacob-1.18-M2-x64.dll"; } File file = new File("lib", jacobDllVersionToUse); System.setProperty(LibraryLoader.JACOB_DLL_PATH, file.getAbsolutePath()); AutoItX x = new AutoItX(); x.run("C:\\Program Files (x86)\\Skype\\Phone\\Skype.exe"); x.sleep(2000); x.winWaitActive("Skype"); x.winActivate("Skype"); }
  17. It seems the AutoIt community does not much venture into AutoItX and the real programmers do not need much to understand how to implement the DLLs -> is there some guidance with explanantions available? This part of the AutoIt site is definitely not getting as much traffic as the rest. Obviously a lot of assumed knowledge and skill applies... I have searched for AutoItX but can not find a single tutorial. There are examples - but what I would really like is a ZIPped project, that explains the C layout, and the link to the AutoIT DLLs. A bit more narrative than code so that I can also learn how... Is there maybe a static Wiki/FAQ on AutoItX that I have missed?
  18. AutoItx and Delphi

    Just wanted to share this for those of us that work with AutoItx3.dll with our Delphi apps. I hand coded the first header file from a C .h header file, but could only get about 60% of the routines to work (my fault, not autoit) I recently went back, and with many hours work and testing, finally came up with this. autoitx3.pas
  19. When I check the list of commands in the Powershell included with Windows 10, I found Assert-AU3IsAdmin, from the module AutoItX. Is anybody else getting this, or did Powershell include AutoItX as one of its modules automatically for everybody? Did you know about this, Jon? To reproduce, start PowerShell and enter "Help Admin". I got Assert-AU3IsAdmin which returns 1 if run as admin and 0 if not. The AU3 in the middle got my attention and I thought to check here. "Help AU3" gave me a huge list of entries. Any ideas?
  20. This is a quick start guide to using the AutoIt PowerShell Cmdlets. The best bits of AutoIt directly from PowerShell The files you need are as follows (get them from the zip file or the Program Files folder after installation): AutoItX.psd1AutoItX3.PowerShell.dllAutoItX3.Assembly.dllAutoItX3.dllAutoItX3_x64.dllTo use the Cmdlets open a PowerShell cmd prompt and enter: Import-Module .\AutoItX.psd1 Now you can get a list of available AutoIt Cmdlets by doing Get-Command *AU3*: PS> Get-Command *AU3* Name Category Module ---- -------- ------ Invoke-AU3MouseWheel Cmdlet AutoItX Move-AU3Mouse Cmdlet AutoItX Invoke-AU3MouseClickDrag Cmdlet AutoItX Get-AU3MouseCursor Cmdlet AutoItX Invoke-AU3MouseUp Cmdlet AutoItX Assert-AU3WinActive Cmdlet AutoItX Assert-AU3WinExists Cmdlet AutoItX Assert-AU3IsAdmin Cmdlet AutoItX Invoke-AU3Shutdown Cmdlet AutoItX Send-AU3ControlKey Cmdlet AutoItX Invoke-AU3MouseDown Cmdlet AutoItX Invoke-AU3MouseClick Cmdlet AutoItX Invoke-AU3ControlTreeView Cmdlet AutoItX Invoke-AU3ControlListView Cmdlet AutoItX Invoke-AU3ControlCommand Cmdlet AutoItX Invoke-AU3ControlClick Cmdlet AutoItX Move-AU3Control Cmdlet AutoItX Set-AU3ControlText Cmdlet AutoItX Show-AU3Control Cmdlet AutoItX Hide-AU3Control Cmdlet AutoItX Get-AU3ControlText Cmdlet AutoItX Get-AU3ControlFocus Cmdlet AutoItX Set-AU3ControlFocus Cmdlet AutoItX Disable-AU3Control Cmdlet AutoItX Enable-AU3Control Cmdlet AutoItX Get-AU3StatusbarText Cmdlet AutoItX Invoke-AU3RunAsWait Cmdlet AutoItX Invoke-AU3RunAs Cmdlet AutoItX Invoke-AU3RunWait Cmdlet AutoItX Invoke-AU3Run Cmdlet AutoItX Set-AU3Clip Cmdlet AutoItX Get-AU3Clip Cmdlet AutoItX Set-AU3WinTrans Cmdlet AutoItX Set-AU3WinTitle Cmdlet AutoItX Set-AU3WinState Cmdlet AutoItX Set-AU3WinOnTop Cmdlet AutoItX Move-AU3Win Cmdlet AutoItX Show-AU3WinMinimizeAllUndo Cmdlet AutoItX Show-AU3WinMinimizeAll Cmdlet AutoItX Get-AU3WinState Cmdlet AutoItX Get-AU3WinProcess Cmdlet AutoItX Get-AU3WinClassList Cmdlet AutoItX Get-AU3WinCaretPos Cmdlet AutoItX Get-AU3WinClientSize Cmdlet AutoItX Get-AU3ControlPos Cmdlet AutoItX Get-AU3ControlHandle Cmdlet AutoItX Get-AU3MousePos Cmdlet AutoItX Get-AU3WinPos Cmdlet AutoItX Get-AU3WinHandle Cmdlet AutoItX Get-AU3ErrorCode Cmdlet AutoItX Initialize-AU3 Cmdlet AutoItX Show-AU3WinActivate Cmdlet AutoItX Close-AU3Win Cmdlet AutoItX Wait-AU3WinClose Cmdlet AutoItX Wait-AU3WinNotActive Cmdlet AutoItX Set-AU3Option Cmdlet AutoItX Send-AU3Key Cmdlet AutoItX Wait-AU3Win Cmdlet AutoItX Wait-AU3WinActive Cmdlet AutoItX Get-AU3WinTitle Cmdlet AutoItX Get-AU3WinText Cmdlet AutoItX I’ll show how to use the Cmdlets using a simple example that will open notepad.exe and modify the edit window by setting the text and simulating some keystrokes. First create a blank PowerShell script called notepad_example.ps1 in the same folder as the AutoItX components above and open it for editing. Now we want to import the PowerShell module which is AutoItX.psd1. Enter the following in the script: Import-Module .\AutoItX.psd1 We want to run notepad.exe: Invoke-AU3Run -Program notepad.exe After notepad opens we want to wait for the notepad “Untitled -Notepad” window to appear. You might need to change the title for non-English versions of Windows: $notepadTitle = "Untitled - Notepad" Wait-AU3Win -Title $notepadTitle $winHandle = Get-AU3WinHandle -Title $notepadTitle Get-AU3WinHandle returns a native Win32 handle to the notepad window. We can use this handle in many other AutoIt functions and it uniquely identifies the window which is much more reliable than constantly using a windows title. If you have obtained a window handle using any other Win32 function you can use it with AutoIt. After obtaining the handle to the notepad window we want to ensure that the window is active and then get a handle to the Edit Control. Using the AU3Info.exe tool that comes with AutoIt we can find that the name of the edit control in notepad is Edit1. Show-AU3WinActivate -WinHandle $winHandle $controlHandle = Get-AU3ControlHandle -WinHandle $winhandle -Control "Edit1" Now that we have a handle to the edit control we can set text in two ways: Directly (Set-AU3Controltext) or with simulated keystrokes (Send-AU3ControlKey): Set-AU3ControlText -ControlHandle $controlHandle -NewText "Hello! This is being controlled by AutoIt and PowerShell!" -WinHandle $winHandle Send-AU3ControlKey -ControlHandle $controlHandle -Key "{ENTER}simulate key strokes - line 1" -WinHandle $winHandleNow let’s see what the entire script looks like: # Import the AutoIt PowerShell module Import-Module .\AutoItX.psd1 # Run notepad.exe Invoke-AU3Run -Program notepad.exe # Wait for an untitled notepad window and get the handle $notepadTitle = "Untitled - Notepad" Wait-AU3Win -Title $notepadTitle $winHandle = Get-AU3WinHandle -Title $notepadTitle # Activate the window Show-AU3WinActivate -WinHandle $winHandle # Get the handle of the notepad text control for reliable operations $controlHandle = Get-AU3ControlHandle -WinHandle $winhandle -Control "Edit1" # Change the edit control Set-AU3ControlText -ControlHandle $controlHandle -NewText "Hello! This is being controlled by AutoIt and PowerShell!" -WinHandle $winHandle # Send some keystrokes to the edit control Send-AU3ControlKey -ControlHandle $controlHandle -Key "{ENTER}simulate key strokes - line 1" -WinHandle $winHandle Send-AU3ControlKey -ControlHandle $controlHandle -Key "{ENTER}simulate key strokes - line 2" -WinHandle $winHandle Send-AU3ControlKey -ControlHandle $controlHandle -Key "{ENTER}{ENTER}" -WinHandle $winHandle This is how the notepad window should look if everything is working correctly:
×