Jump to content

Recommended Posts

Posted

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

Posted

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

Posted

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?

Posted

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)
Posted

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!
  • 12 years later...
Posted
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

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
  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...