Jump to content
GrAaL

Multiple Winwaitactive

Recommended Posts

GrAaL

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
GrAaL

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
Uten

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
MHz

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
Uten

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
Kratos
On 03/04/2006 at 5:26 PM, GrAaL said:

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

$hWnd = WinWaitActive("[REGEXPTITLE:(WindowWithThisTitle|WindowWithThatTitle)]")

If WinGetTitle($hWnd) = "WindowWithThisTitle" then
    DoSomething()
Else
    DoSomethingElse()
EndIf

Share this post


Link to post
Share on other sites
FrancescoDiMuro

Don't necropost...


Click here to see my signature:

Spoiler

I will always thank you for the time you spent for me.
I'm here to ask, and from your response, I'd like to learn.
By my knowledge, I can help someone else, and "that someone" could help in turn another, and so on.

ALWAYS GOOD TO READ:

In case I am violating some pseudo Forum rule, or I am doing something wrong, I want let you know that I'm not doing this on purpose, and for this, I kindly ask you to send me a private message about the "bad content" I posted, in order to edit/remove it, and to not be warned wrongly.
Thanks in advance.

 

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

×