Jump to content

Control Click, not clicking?


Go to solution Solved by llewxam,

Recommended Posts

I'm applying some security settings to files, a bunch of the files I don't have permission on, which is another issues that's going to be fixed after this.

Anyway, I need to click Continue a couple thousand times without destroying my wrist. Here's what I have so far.
 

 WinActivate("Error Applying Security")
 Sleep(100)
 ControlClick("Error Applying Security", "&Continue", "[CLASS:Button: INSTANCE:1]")
 Sleep(100)

I'll worry about looping it once I've got it working right.

I used the window info tool to get what I've got there, but it just doesn't click the button. I run the script, nothing happens. I've also tried using MouseMove to that location and MouseClick, with similar results, mouse moves, nothing happens.

Is this because it's a virtual machine that I'm connected to? I don't have AutoIt installed on the server, I'm compiling the script and running it locally on the server I've just been connecting to it via RDP, I also tried the vSphere Console as well to no avail.

Thanks for any help you can offer.
 

Edited by JfreemanRCA
Link to comment
Share on other sites

Windows shown through vsphere are just pixels...you won't be able to hook into the handles.

You'll need to execute the script on the VM, locally.

IEbyXPATH-Grab IE DOM objects by XPATH IEscriptRecord-Makings of an IE script recorder ExcelFromXML-Create Excel docs without excel installed GetAllWindowControls-Output all control data on a given window.
Link to comment
Share on other sites

  • Solution

You can also do something like this (again through vSphere):

Do
    Sleep(50)
Until WinExists("Error Applying Security")
WinActivate("Error Applying Security")
Sleep(100)
Send("{TAB}")
Send("{SPACE}")
Sleep(100)

Assuming it only takes 1 TAB to highlight the OK button, if not use additional Send commands.

Ian

My projects:

  • IP Scanner - Multi-threaded ping tool to scan your available networks for used and available IP addresses, shows ping times, resolves IPs in to host names, and allows individual IPs to be pinged.
  • INFSniff - Great technicians tool - a tool which scans DriverPacks archives for INF files and parses out the HWIDs to a database file, and rapidly scans the local machine's HWIDs, searches the database for matches, and installs them.
  • PPK3 (Persistent Process Killer V3) - Another for the techs - suppress running processes that you need to keep away, helpful when fighting spyware/viruses.
  • Sync Tool - Folder sync tool with lots of real time information and several checking methods.
  • USMT Front End - Front End for Microsoft's User State Migration Tool, including all files needed for USMT 3.01 and 4.01, 32 bit and 64 bit versions.
  • Audit Tool - Computer audit tool to gather vital hardware, Windows, and Office information for IT managers and field techs. Capabilities include creating a customized site agent.
  • CSV Viewer - Displays CSV files with automatic column sizing and font selection. Lines can also be copied to the clipboard for data extraction.
  • MyDirStat - Lists number and size of files on a drive or specified path, allows for deletion within the app.
  • 2048 Game - My version of 2048, fun tile game.
  • Juice Lab - Ecigarette liquid making calculator.
  • Data Protector - Secure notes to save sensitive information.
  • VHD Footer - Add a footer to a forensic hard drive image to allow it to be mounted or used as a virtual machine hard drive.
  • Find in File - Searches files containing a specified phrase.
Link to comment
Share on other sites

  • 9 years later...

Thanks llewxam for your suggestions here.

I was trying to automate  Win10 Defender/Windows Security. AsAdmin, I could use autoIT to launch it, close it, move it but NOTHING worked to click on the controls inside the window, including all combinations of ControlClick to locations on the window.  I had read windows UIAutomation was the likely problem and  had forgotten about SendKeys.

My goal was to automate the separate key presses to turn off RealTimeProtection VERY OFTEN, since it now [2024] randomly turns itself back on, sometimes only minutes later.

The following opens the Defender window, navigates to the section showing the RTP setting, shrinks the window, and moves to the right lower corner, so I can see if RTP is on or not. The on/off slider is always in view, mainly so I can turn RTP off with one click.  My screen resolution is 1600x900 for those WinMove settings

                Run(@ComSpec & " /c start windowsdefender: ")
                $hwnd = WinWaitActive('Windows Security')    
                WinActivate($hwnd)              
                WinSetState('Windows Security', "", @SW_MAXIMIZE)
                Sleep(2000)
                ;============ found      \/
                If $hwnd > 0 then
                WinActivate($hwnd)    
                Send("{TAB 4}")
                Send("{SPACE}")
                Sleep(1000)   ; Wait to see what happened. REDUCE ALL SLEEPS ONCE THIS WORKS
                Send("{TAB 5}")
                Send("{SPACE}")
                Sleep(2000)   
                WinMove("Windows Security", "", 1460, 476, 50, 50, 1)
                EndIf
                ;============= found     /\

Link to comment
Share on other sites

Wow, sorry but I have to say, almost a decade after the last post you reopen this topic with some arbitrary related content.
That's totally unnecessary 😒 .

Edited by SOLVE-SMART

Stay innovative!

Spoiler

🌍 Au3Forums

🎲 AutoIt (en) Cheat Sheet

📊 AutoIt limits/defaults

💎 Code Katas: [...] (comming soon)

🎭 Collection of GitHub users with AutoIt projects

🐞 False-Positives

🔮 Me on GitHub

💬 Opinion about new forum sub category

📑 UDF wiki list

✂ VSCode-AutoItSnippets

📑 WebDriver FAQs

👨‍🏫 WebDriver Tutorial (coming soon)

Link to comment
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
 Share

  • Recently Browsing   0 members

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