Sign in to follow this  
Followers 0
astronomer

Choice of two windows

7 posts in this topic

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.

Share this post


Link to post
Share on other sites



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?

Share this post


Link to post
Share on other sites

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

Share this post


Link to post
Share on other sites

#5 ·  Posted (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 by JdeB

Visit the SciTE4AutoIt3 Download page for the latest versions        Beta files                                                          Forum Rules
 
Live for the present,
Dream of the future,
Learn from the past.
  :)

Share this post


Link to post
Share on other sites

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

Share this post


Link to post
Share on other sites

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
Thank 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.

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
Sign in to follow this  
Followers 0