Sign in to follow this  
Followers 0
GrAaL

Multiple Winwaitactive

6 posts in this topic

Hi all !!!

I need to check for two different windows to protect an application from user's modifications.

I think that a WinWaitActive wan help me to do so, but, is there a way to check for two WinWaitActive at the same time. I was thinking about something like

While (WinWaitActive("windows 1", "text 1") OR WinWaitActive("windows 2", "text 2"))

ControleDisable("windows1", "text1", "ControlX")

ControleDisable("windows2", "text2", "ControlY")

Wend

But it talk about parsing error....

Have you got a solution

Thanks a lot

Share this post


Link to post
Share on other sites



Just use the timeout option on WinWaitActive

WinWaitActive ( "title" [, "text" [, timeout]] )
I can't let the autoIT script loop every xx secondes because 80 users will use it at the same time on the same server, big performance trouble.....

there're no way the 'wait' for two events ????

(thansk a lot for your reply

Share this post


Link to post
Share on other sites

No, unfortunately. No event callbacks.

So either 1 script for each window.

Or using sleep(XXX ms) in the loop.

WinWaitActive will also make your process appear to sleep.

So the big question is how important is it to detect the windows and how fast must they be handled?

Share this post


Link to post
Share on other sites

I can't let the autoIT script loop every xx secondes because 80 users will use it at the same time on the same server, big performance trouble.....

there're no way the 'wait' for two events ????

(thansk a lot for your reply

The Latest AutoIt Beta can wait for more then 2 windows by using regular expressions.

Here is a Demo

Opt('WinTitleMatchMode', 4)
Switch Random(1, 3, 1)
    Case 1
        RunWait('explorer "' & @ProgramFilesDir & '"')
    Case 2
        RunWait('explorer "' & @WindowsDir & '"')
    Case 3
        RunWait('explorer "' & @SystemDir & '"')
EndSwitch
WinWait('regexp=(?i)program files|windows|system32', '', 1)
$title = WinGetTitle('regexp=(?i)program files|windows|system32')
Sleep(500)
WinClose($title)

Share this post


Link to post
Share on other sites

Opt('WinTitleMatchMode', 4)
WinWait('regexp=(?i)program files|windows|system32', '', 1)
$title = WinGetTitle('regexp=(?i)program files|windows|system32')
Sleep(500)
WinClose($title)
Wow, neat trick!

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