astronomer Posted June 3, 2007 Share Posted June 3, 2007 Hi everyone. I hope someone can help me. I have used AutoIt v3 to create a script that will run an anti-spyware application scan. It start's up, It Sends, and acts on, the correct simulated keypresses to initiate the scan. The scan begins and completes as it should (thank you AutoIt). Now my problem: When the scan completes, a couple of windows can appear depending on whether the scan located any spyware or not. Usually/mostly the scans are clear and a little dialog pops up and says "All Clear" and the operator (me) has to click an OK button to close the dialog. This all works well in the AutoIt script, I use "WinWaitActive" to wait for that dialog to appear, then "Send" a simulated ENTER keystroke to close the dialog. Now........ if that dialog doesn't appear, i.e. if some spyware has been found, how do I get AutoIt to recognise that the "All Clear" dialog wont appear and stop waiting on it, so that I may get AutoIt to act on the delete spyware options? Many thanks in advance. Link to comment Share on other sites More sharing options...
Glyph Posted June 3, 2007 Share Posted June 3, 2007 (edited) while 1 $window1=winwaitactive ("blah","") $window2=winwaitactive ("blah2","") if $window1=1 then ;do blaah endif if $window2=1 then ;do blah endif wend Edited June 3, 2007 by backstabbed tolle indicium Link to comment Share on other sites More sharing options...
astronomer Posted June 3, 2007 Author Share Posted June 3, 2007 while 1 $window1=winwaitactive ("blah","") $window2=winwaitactive ("blah2","") if $window1=1 then ;do blaah endif if $window2=1 then ;do blah endif wend Ahhhhhhh I see, <insert, slaps head smilie> . Thank you so much, backstabbed, I really appreciate your help. I've just started using AutoIt and couldn't figure it out for myself, that looks exactly like what I need. Just one supplementary question, if I can impose on you a little more, please. This script will be part of a larger script that I'm trying to create. The larger script runs a few other programs as well, the programs start, run and close, one after the other. I already have a "While 1 -- Wend" loop, so the one you have shown above will be Nested within the "While 1.....Wend" loop I already have. Will that be a problem do you think? Link to comment Share on other sites More sharing options...
Glyph Posted June 3, 2007 Share Posted June 3, 2007 Yeah, just put it at the top of your existing while loop... and see what that does . Not sure if it will work, let me know if it doesn't. tolle indicium Link to comment Share on other sites More sharing options...
Developers Jos Posted June 3, 2007 Developers Share Posted June 3, 2007 (edited) The WinWaitActive() won't work to well when the second window becomes active ... You need to use WinExists() to test for multiple windows. While 1 If WinExists("window 1", "") Then ;do blaah EndIf If WinExists("window 2", "") Then ;do blaah EndIf Sleep(50) WEnd Edited June 3, 2007 by JdeB SciTE4AutoIt3 Full installer Download page - Beta files Read before posting How to post scriptsource Forum etiquette Forum Rules Live for the present, Dream of the future, Learn from the past. Link to comment Share on other sites More sharing options...
Glyph Posted June 3, 2007 Share Posted June 3, 2007 The WinWaitActive() won't work to well when the second window becomes active ... You need to use WinExists() to test for multiple windows. While 1 If WinExists("window 1", "") Then ;do blaah EndIf If WinExists("window 2", "") Then ;do blaah EndIf Sleep(50) WEnd it was just a rough example -.- tolle indicium Link to comment Share on other sites More sharing options...
astronomer Posted June 4, 2007 Author Share Posted June 4, 2007 The WinWaitActive() won't work to well when the second window becomes active ... You need to use WinExists() to test for multiple windows. While 1 If WinExists("window 1", "") Then ;do blaah EndIf If WinExists("window 2", "") Then ;do blaah EndIf Sleep(50) WEndThank you for your input, JdeB, I really do appreciate your help. I have used your code and it seems to be working okay at the moment. I hope to try backstabbed's idea as well when I have streamlined things a little more (need more spare time, lol). Thank you both sincerely for your help and time. 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