MrMike2000 Posted March 29, 2020 Posted March 29, 2020 (I hope I'm posting this in the correct forum; if not, my apologies; please let me know and I'll be happy repost it in the proper place.) I'm looking at using AutoIt to do a minor task and figured I'd ask about it here. I'm using Win 10 Pro on a PC that's dedicated to running some security software. I use an administration app that pops up a dialog box after it's closed, and I'd like to have autoit lurk quietly in the background waiting for that specific dialog box to appear. When it appears I'd like to have autoit click on a button to dismiss the dialog box. I'm guessing this isn't the first time somebody has wanted to do something this and I'm hoping that someone here might be able to point me to an example script that does this, or a script that I could modify to do this. Could anyone point me in the right direction? Thank you for any assistance you can offer.
Nine Posted March 29, 2020 Posted March 29, 2020 Try Google. Ask the question there. You will find multiple of examples of what could fit your requirements. Put some code together and come back if you have any issue. Your question is way too general for us to answer. “They did not know it was impossible, so they did it” ― Mark Twain Spoiler Block all input without UAC Save/Retrieve Images to/from Text Monitor Management (VCP commands) Tool to search in text (au3) files Date Range Picker Virtual Desktop Manager Sudoku Game 2020 Overlapped Named Pipe IPC HotString 2.0 - Hot keys with string x64 Bitwise Operations Multi-keyboards HotKeySet Recursive Array Display Fast and simple WCD IPC Multiple Folders Selector Printer Manager GIF Animation (cached) Debug Messages Monitor UDF Screen Scraping Round Corner GUI UDF Multi-Threading Made Easy Interface Object based on Tag
MrMike2000 Posted March 29, 2020 Author Posted March 29, 2020 1 hour ago, Nine said: Try Google. Ask the question there. You will find multiple of examples of what could fit your requirements. Put some code together and come back if you have any issue. Your question is way too general for us to answer. Well, I did say it was a general question. I had googled quite a bit but wasn't sure about the "lurking in the background part". What I've found seems to boil down to something like this: #RequireAdmin WinActivate("Delcap System") ControlClick("Delcap System", "", "[CLASSNN:Button3]") The dialog box title is "Delcap system" and there are 3 buttons. The one I want to click is the 3rd one at the far left of the dialog box. Does this seem more or less what I should start with, or...?
Subz Posted March 30, 2020 Posted March 30, 2020 Unsure if you require the #RequireAdmin, but yes that appears to be the correct approach, although maybe there is a switch for the Delcap system which will allow you to automate this.
MrMike2000 Posted March 30, 2020 Author Posted March 30, 2020 Thank you, Subz. 53 minutes ago, Subz said: although maybe there is a switch for the Delcap system which will allow you to automate this. Do you mean within delcap or within autoit? I'm pretty sure there's nothing in delcap to do this. I did get the basic script working, though; if the dialog box is open on the screen and I run the script (dc_closer.au3) then it does click the correct button and close the dialog box. I think the only thing I need to figure out now is how to get autoit to automatically look for the presence of the dialog box. Is there a way for autoit to look for or sense the dialog box appearing? If not, I'm thinking I'll set a scheduled task to run the closer.au3 script once a minute or so, but that seems sort of kludgy and wasteful of resources.
MrMike2000 Posted March 30, 2020 Author Posted March 30, 2020 Hmmm, no way to edit posts? Anyway, I think I have this sorted. I stuck the kill-window code in an endless While/WEnd loop, and let it Sleep() for 15 seconds, check for the window, Sleep() for 15 seconds, and so on. Seems to work exactly as I'd hoped. I started off using TimerDiff() and TimerInit() but found that a 10 line script was using ~15% of my CPU (both as a compiled executable and running as a script) according to Task Manager. Using Sleep() seems to cut the CPU usage basically to zero. 👍 Thank you for pointing me in the right direction, Subz, I appreciate it.
Recommended Posts
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 accountSign in
Already have an account? Sign in here.
Sign In Now