Jump to content

Recommended Posts

Hi

So I am trying to click the green button, this button is not always in the same place. So fare I am trying to click it by finding the color but there is also something else with the same color on the screen (circled in yellow) that is causing issues. Is there a way to use the Title and Class of the window (can't be just the window as there are more than one with the same name).

How does AutoIt Info get this information?

Annotation 2020-04-27 171250.png

Share this post


Link to post
Share on other sites
Posted (edited)

Imagesearch coud work with that, you just need to screenshot the button (crop the image to button), and not change the image size, the button in the image has to be the same size, then it will find the button and you can direct to click.

IUAutomation is a totally different beast, kinda slow too, imo.

 

Edited by careca

Spoiler

Renamer - Rename files and folders, remove portions of text from the filename etc.

GPO Tool - Export/Import Group policy settings.

MirrorDir - Synchronize/Backup/Mirror Folders

BeatsPlayer - Music player.

Params Tool - Right click an exe to see it's parameters or execute them.

String Trigger - Triggers pasting text or applications or internet links on specific strings.

Inconspicuous - Hide files in plain sight, not fully encrypted.

Regedit Control - Registry browsing history, quickly jump into any saved key.

Time4Shutdown - Write the time for shutdown in minutes.

Power Profiles Tool - Set a profile as active, delete, duplicate, export and import.

Finished Task Shutdown - Shuts down pc when specified window/Wndl/process closes.

NetworkSpeedShutdown - Shuts down pc if download speed goes under "X" Kb/s.

IUIAutomation - Topic with framework and examples

Au3Record.exe

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

  • Recently Browsing   0 members

    No registered users viewing this page.

  • Similar Content

    • By Jahar
      Hi All,
      Please help me on how to fetch date/time of last windows 10 system restore point using autoit? Basically its about querying the last restore point.
    • By Jamestay97
      Hello! Thanks you for looking at my post
      **No source code I'm sorry work related can't copy information**
      I've been using autoit for about 1 year. 
      I'm having trouble automating a click on an internet explorer web page and I've tried a lot of examples from help pages and forums already. The object I'm trying to click on isnt always in the same spot so I can't use mouse click or control click, I have tried to use the different get collection options and clickbyname, or index or get object. I'm just struggling. 
      Description of object I'm trying to click -- 
      HTML Code looks like <a ng-click.. "Click Here" it appears it's just a click able object named "click here" that opens a hidden window by running a script inside the web page. I'm not able to grab the information from the window unless it's open so I have to automate this click somehow. 
       
      I understand it's difficult to assist without having something to look at, I apologize for that sincerely and appreciate and assistance and suggestions. 
    • By nacerbaaziz
      question about _WinAPI_CreateWindowEx
      good morning
      welcome autoit team
      please i need your help
      i've searched a lot about how to use the _WinAPI_CreateWindowEx
      finally i found an example
      but i found some problem i hope you can help me
      firstly, i want to set the controls focussable with the keyboard input
      i already used the ws_tabStop but it did not work with me.
      secondly, i want to set some access keys linked with the window
      such as control+o enable the open button and control+f4 exit the app
      note: i need a local access keys and not a global hotkeys
      such as GUISetAccelerators
      finaly, before i will put the code here i must clarify a few things.
      1. you will ask me why you don't use the GUICreate function
      here i'll tell you that it as dialog and It is a little heavy in motion with screen readers.
      the screen readers for blind has some function that work with dialogs and others work with full windows style
      2. you will ask me why you didn't search the net for that?
      i will tell you that all examples that i found in the internet with pdfs and Picture books.
      i found some examples in microsoft but it with cpp.
      ok here is the code
      i hope you can help me to do what i want
      thank you in advance
       
      ; Small AutoIt Application that uses Windows API ; Written by Yuraj #NoTrayIcon #include <_RegisterClassEx.au3> #include <WinAPI.au3> #include <WindowsConstants.au3> #include <ButtonConstants.au3> #include <EditConstants.au3> #include <FontConstants.au3> AutoItSetOption("MustDeclareVars", 1) ; Window definitions Const $WinWidth = 370 Const $WinHeight = 350 Const $WinXPos = (@DesktopWidth / 2) - ($WinWidth / 2) Const $WinYPos = (@DesktopHeight / 2) - ($WinHeight / 2) Const $WinTitle = "Win32 Application - Text reader" Const $WinClass = "mainapp" Const $WinIcon = _WinAPI_LoadIcon(_WinAPI_GetModuleHandle("shell32.dll"), 13) ; Windows handles Global $hwnd, $edit1, $btn1, $btn2 ; Fonts Global $fnt1 ; Register class, Create the window Local $retVal = __WinAPI_RegisterClassEx($WinClass, "WindowCallback", $WinIcon, 0, _WinAPI_GetSysColor($COLOR_BTNFACE), BitOR($CS_DEFAULTSTYLE, $CS_DROPSHADOW)) ; If $retVal == 0 Then ; If registerclass fails MsgBox(16, "Error", "Error while registering window class!") Exit EndIf ; Create windows/controls $hwnd = _WinAPI_CreateWindowEx($WS_EX_STATICEDGE, $WinClass, $WinTitle, BitOR($WS_OVERLAPPED,$WS_SYSMENU, $WS_MINIMIZEBOX, $WS_GROUP, $WS_DLGFRAME), $WinXPos, $WinYPos, $WinWidth, $WinHeight, 0) $btn1 = _WinAPI_CreateWindowEx(0, "button", "Open file ...", BitOR($WS_VISIBLE, $WS_CHILD, $WS_TABSTOP, $WS_CLIPCHILDREN), 25, 270, 100, 30,$hwnd) $btn2 = _WinAPI_CreateWindowEx(0, "Button", "Exit", BitOR($WS_VISIBLE, $WS_CHILD, $WS_TABSTOP, $WS_CLIPCHILDREN), 235, 270, 100, 30, $hwnd) $edit1 = _WinAPI_CreateWindowEx(0, "edit", "text", BitOR($WS_VISIBLE, $WS_CHILD, $WS_VSCROLL, $ES_AUTOVSCROLL, $es_readOnly, $WS_TABSTOP), 5, 5, $WinWidth - 15, $WinHeight - 100, $hwnd) ; Set controls identifiers _WinAPI_SetWindowLong($btn1,$GWL_ID,150) _WinAPI_SetWindowLong($btn2,$GWL_ID,160) ; Set (controls) fonts $fnt1 = _CreateFont("MS Sans Serif", 15) _WinAPI_SetFont($btn1, $fnt1) _WinAPI_SetFont($btn2, $fnt1) _WinAPI_SetFont($edit1, $fnt1) ; Set focus to edit _WinAPI_SetFocus($edit1) ; Show window _WinAPI_ShowWindow($hwnd) _WinAPI_UpdateWindow($hwnd) ; Main loop that keep application opened While 1 Sleep(100) WEnd ;=================================================================; ; WINDOW CALLBACK ... ;=================================================================; Func WindowCallback($_hwnd, $iMsg, $wParam, $lParam) Local $iNC, $iID Switch $iMsg ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; Case $WM_CLOSE ; Show message on closing If MsgBox(48 + 4, $WinTitle, "Do you want really exit?", 0, $hwnd) <> 6 Then Return 0 ; Call destructor and then exit main thread FinalizeApp() Exit ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; Case $WM_COMMAND $iNC = _WinAPI_HiWord($wParam) $iID = _WinAPI_LoWord($lParam) Switch $iNC Case $BN_CLICKED ; When is control clicked Switch _WinAPI_GetDlgCtrlID($iID) Case _WinAPI_GetDlgCtrlID($btn1) BtnOpenFileClick() Case _WinAPI_GetDlgCtrlID($btn2) BtnExitClick() EndSwitch EndSwitch ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; EndSwitch Return _WinAPI_DefWindowProc($_hwnd, $iMsg, $wParam, $lParam) EndFunc ;==>WindowCallback Func FinalizeApp() _WinAPI_DeleteObject($fnt1) _WinAPI_DestroyWindow($hwnd) __WinAPI_UnregisterClass($WinClass) EndFunc ;==>FinalizeApp Func _CreateFont($fontName, $height = 16, $style = $FW_NORMAL, $italic = False, $underline = False, $strikeout = False) Local $hFont = _WinAPI_CreateFont($height, 0, 0, 0, $style, $italic, $underline, $strikeout, $DEFAULT_CHARSET, _ $OUT_DEFAULT_PRECIS, $CLIP_DEFAULT_PRECIS, $DEFAULT_QUALITY, $DEFAULT_PITCH, $fontName) Return $hFont EndFunc ;==>_CreateFont ;=================================================================; ; WINDOW EVENTS ;=================================================================; Func BtnOpenFileClick() Local $ret = _WinAPI_GetOpenFileName("", "Text files (*.txt)|All files (*.*)", ".", "", "", 1, 0, 0, $hwnd) If ($ret[0] > 0) Then Local $path = $ret[1] & "\" & $ret[2] Local $file = _WinAPI_CreateFile($path, 2, 2) Local $buf = DllStructCreate("byte[" & _WinAPI_GetFileSizeEx($file) & "]") Local $i = 0 _WinAPI_ReadFile($file, DllStructGetPtr($buf), _WinAPI_GetFileSizeEx($file), $i) ; Close file handle _WinAPI_CloseHandle($file) _WinAPI_SetWindowText($edit1, BinaryToString(DllStructGetData($buf, 1))) EndIf EndFunc ;==>BtnOpenFileClick Func BtnExitClick() FinalizeApp() Exit EndFunc ;==>BtnExitClick  
      _RegisterClassEx.au3
    • By Skysnake
      Hi guys
      AutoIt content - Microsoft thinks any AutoIt content is unwanted.
      What it does is simply delete any EXEs. No option of do you want to continue...
      The March 2020 updated has substantially changed the Defender Virus Protection logic and layout.
      I found three pages relevant to the help, and lots of outdated content. Is there a quick and easy way to set folder exclusions? Any help is appreciated and simply using google is not good enough, as this is a new problem, caused by the update.
      Any ideas please?
      ____________________________
      ANSWER
      Found it.
      Accessing the menu through the Control Panel does not work
      Click the Defender shield in the icon tray.
      Scroll down to Virus & threat protection settings click Manage Settings Scroll down to Exclusions click Add or remove exclusions then click the + for Add an exclusion, and select File / Folder / File type / Process 
      Select Folder and browse to select. 😥
       
      Skysnake
    • By jantograaf
      Hi all,
      I'm trying to automate the install of a specific networking device. All goes well, I can install the driver on both Windows 7 & 10, rescan for hardware, set the IP-settings and all, but there's one issue. In Windows 10, I can disable all connection protocols using Powershell, but Windows 7 does not offer this Powershell-Cmdlet. So I programmed a way (two years ago) to let AutoIt open the network-adapter properties and then deselect all checkboxes except for the TCP/IP-V4. I recovered this snippet somewhere in my old files and tried to reintegrate this into my latest script, but it doesn't seem to work. On Windows 10 I get a blank screen for a few seconds and that's it, on Windows 7 it makes explorer crash. 
      I think it's quite safe to test this on your own system as long as you're not using IPv6 to connect to the internet and as long as you return to check all the boxes again (so you don't break your connectivity).
      If  anyone has any idea, I'd be glad to hear from you!
      Thanks in advance and stay safe in these Corona-ridden times 🙂
      Kind regards,
      Jan
       

      There are three functions involved:
      DisableAllProtocols($AdapterName)
      This one is the main function that 'should' uncheck all the checkboxes in the adapter's Properties-window.
      Func DisableAllProtocols($AdapterName) OpenNetConnToAdapter($AdapterName) ;Find the IDs of all relevant controls Local $Handle_Window_Properties = WinWaitActive($Adaptername & " Properties","") Local $Handle_Listview_Protocols = ControlGetHandle($Adaptername & " Properties","","[CLASSNN:SysListView321]") Local $Handle_OK_Button = ControlGetHandle($Adaptername & " Properties","","[CLASSNN:Button6]") Local $List_CMN_ID = ControlListView($Adaptername & " Properties","","[CLASSNN:SysListView321]","FindItem","Client for Microsoft Networks") Local $List_FPSMN_ID = ControlListView($Adaptername & " Properties","","[CLASSNN:SysListView321]","FindItem","File and Printer Sharing for Microsoft Networks") Local $List_QOS_ID = ControlListView($Adaptername & " Properties","","[CLASSNN:SysListView321]","FindItem","QoS Packet Scheduler") Local $List_MNAMP_ID = ControlListView($Adaptername & " Properties","","[CLASSNN:SysListView321]","FindItem","Microsoft Network Adapter Multiplexor Protocol") Local $List_MLLDPPD_ID = ControlListView($Adaptername & " Properties","","[CLASSNN:SysListView321]","FindItem","Microsoft LLDP Protocol Driver") Local $List_IPV6_ID = ControlListView($Adaptername & " Properties","","[CLASSNN:SysListView321]","FindItem","Internet Protocol Version 6 (TCP/IPv6)") Local $List_LLTDR_ID = ControlListView($Adaptername & " Properties","","[CLASSNN:SysListView321]","FindItem","Link-Layer Topology Discovery Responder") Local $List_LLTDMIOD_ID = ControlListView($Adaptername & " Properties","","[CLASSNN:SysListView321]","FindItem","Link-Layer Topology Discovery Mapper I/O Driver") ; Disable All Protocols Except IPV4 SetCheckboxState($Handle_Listview_Protocols,$List_CMN_ID,3) SetCheckboxState($Handle_Listview_Protocols,$List_FPSMN_ID,3) SetCheckboxState($Handle_Listview_Protocols,$List_QOS_ID,3) SetCheckboxState($Handle_Listview_Protocols,$List_MNAMP_ID,3) SetCheckBoxState($Handle_Listview_Protocols,$List_MLLDPPD_ID,3) SetCheckboxState($Handle_Listview_Protocols,$List_IPV6_ID,3) SetCheckboxState($Handle_Listview_Protocols,$List_LLTDR_ID,3) SetCheckboxState($Handle_Listview_Protocols,$List_LLTDMIOD_ID,3) ;Click OK ControlClick($Handle_Window_Properties,"","Button6") Sleep(50) WinClose("Network Connections") EndFunc OpenNetConnToAdapter($AdapterName)
      This function opens the network adapter's Properties-page
      Func OpenNetConnToAdapter($AdapterName) ShellExecute("control.exe","ncpa.cpl",@WindowsDir,"",@SW_SHOW) WinWait("Network Connections","") WinActivate("Network Connections","") Local $Handle_Window_NetworkConnections = WinWaitActive("Network Connections","") Send("{F5}") Sleep(250) Local $AdapterNameArray = StringSplit($AdapterName,"") For $i = 1 To $AdapterNameArray[0] Step 1 Send($AdapterNameArray[$i]) Sleep(10) Next Sleep(50) Send("{APPSKEY}") Sleep(50) Send("{R}") Sleep(500) Return EndFunc SetCheckboxState($Handle,$checkbox_id,$wantedstate)
      This function changes the state of a checkbox
      Func SetCheckboxState($handle,$checkbox_id,$wantedstate) ;$handle : SysListView32-handle ;$checkbox_id : The ID of the checkbox you want to control ;$wantedstate : The wanted status (2 for checked, 3 for unchecked) Local $currentstate = _GUICtrlListView_GetItemStateImage($handle,$checkbox_id) If $currentstate = $wantedstate Then Return Else _GUICtrlListView_SetItemSelected($handle,$checkbox_id,True,True) Send("{Space}") Sleep(50) Return EndIf EndFunc  
×
×
  • Create New...