ROSharps Posted May 9, 2011 Share Posted May 9, 2011 Hi, To begin, I am rather new to Autoit and SciTE. In fact, I just started playing around with it yesterday. The main reason I started using Autoit is because I would like to make a few virus removal programs, and patches automated. I started with Malwarebytes and was able to get it to install update and run a scan automatically, I have not been able to finish writing the removal process because I need to test it on an infected computer. When programming for Malwarebytes I ran into a few issues that took me a good amount of time to get around. The issue that I encountered was how to differentiate between different application message boxes. For example in Malwarebytes, after updating the program there are two message boxes that can come up. One is "The database have been successfully updated", and the second "The program is already up to date." Both of which require an OK to be pressed. My way around this issue was with a flag that would differentiate between he two textboxes. Well long story short, I started working on trying to get ComboFix to be automated through all of the different message boxes that it displays. Now the problem lies in the fact that some of the message boxes show up on some computers and some do not. For example the installation of the Microsoft Recovery... shows up on Windows XP and not one Windows 7. I have tried different ways of figuring out which message box shows up and which one does not, but I am having the hardest time doing this with SciTE scripting. I was wondering, is there a way to develop a function that acts as a thread that would check for different popup windows. Once a popup Windows is detected, the title and text would be compared to the different possible message boxes that exist. At which point, different actions can occur based on different pop ups. If this is not possible, can anyone guide me in a simple if then statement that would compare the different message boxes when one is displayed, and an idea as to how to check the message box at the right time. Thank you in advance for the support. Link to comment Share on other sites More sharing options...
enaiman Posted May 9, 2011 Share Posted May 9, 2011 (edited) WinActive is what you are looking for.As for taking different actions - that resumes to detect correctly active windows by matching windows titles and text; a simple Select/EndSelect can do that.Just put it in a function and run that function every few seconds.Select Case WinActive("My First Box", "My First Box Text") ;take whatever action you want for the first box Case WinActive("My Second Box", "My Second Box Text") ;take whatever action you want for the second box ;and so on ... EndSelectEdit: if WinActive is "misbehaving", you can use WinExists. Edited May 9, 2011 by enaiman SNMP_UDF ... for SNMPv1 and v2c so far, GetBulk and a new example script wannabe "Unbeatable" Tic-Tac-Toe Paper-Scissor-Rock ... try to beat it anyway :) Link to comment Share on other sites More sharing options...
AdmiralAlkex Posted May 9, 2011 Share Posted May 9, 2011 Instead of doing a half billion WinActive you could just do one (1!) WinGetTitle(). Think about that. .Some of my scripts: ShiftER, Codec-Control, Resolution switcher for HTC ShiftSome of my UDFs: SDL UDF, SetDefaultDllDirectories, Converting GDI+ Bitmap/Image to SDL Surface Link to comment Share on other sites More sharing options...
ROSharps Posted May 9, 2011 Author Share Posted May 9, 2011 Hi, I just wanted to post back and let you know that your idea worked flawlessly (enaiman). Thank you so much for the help. Also, AdmiralAlkex, your idea works on most programs and I was able to use it for other applications but for combofix, a lot of the titles were the same and some similar text as well. Other than that, I still needed a case statement for the different titles. Thank you again to the both of you Link to comment Share on other sites More sharing options...
AdmiralAlkex Posted May 10, 2011 Share Posted May 10, 2011 Switch WinGetTitle("[Active]") case "first box" ;something case "second box" ;something something endswitch It wouldn't be hard to add text in there too. $sTitle = WinGetTitle("[Active") $sText = WinGetText("[Active") Select Case $sTitle = "first box" and $sText = "i'm some text" Case $sTitle = "second box" and $sText = "other text" EndSelect .Some of my scripts: ShiftER, Codec-Control, Resolution switcher for HTC ShiftSome of my UDFs: SDL UDF, SetDefaultDllDirectories, Converting GDI+ Bitmap/Image to SDL Surface Link to comment Share on other sites More sharing options...
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