Sign in to follow this  
Followers 0
eagle51

Is there something like "If WinWaitActive..... Then"

13 posts in this topic

Hello guys,

is there something like

If(WinWaitActive("Information", "Fehler aufgetreten")) Then                         Call("Terminate2")
EndIf

I need to find out whether an error-message appeared or not :)

Thanks

eagle51

Share this post


Link to post
Share on other sites



#4 ·  Posted (edited)

Call ?

For shame... :-)

Edit: Sorry, inside joke - you do not need Call. BTW, Welcome to the forums.

You can make you script to handle all of the "normal windows" and use the adlib function to handle errors.

Edited by herewasplato

[size="1"][font="Arial"].[u].[/u][/font][/size]

Share this post


Link to post
Share on other sites

If(WinWaitActive("Information", "Fehler aufgetreten")) Then

Call("Terminate2")

; do other things

EndIf

Doesn't work :)

@here: I don't understand :D

@all:

The problem is...

My script is deleting a bunch of entries in a database.

In the begining the user being asked how much entries he want to delete. If he enters "-1", the script will delete all.

When the last entry is deleted a message appears. Therefore I need the "If".....

:D

Sorry for my bad english :P

Share this post


Link to post
Share on other sites

If I'm getting you right, all you need to do is...

WinWaitActive("Information", "Fehler aufgetreten") ;this will pause the script until the window is active

Terminate2()

You may also want to do something like this instead...

(this will wait until the window exists so doesn't need to be active, necessarily)

;code etc

Do

Sleep(100)

Until WinExists("Information", "Fehler aufgetreten")

Terminate2()

Share this post


Link to post
Share on other sites

@here: I don't understand :)

When you know the function to call at the time you write the script there's no reason at all to use Call,

meaning when you pass it just a string and no variables, macros, expressions or whatever, it is just

meaningless to use it.

Let us say that we have three functions, and we want the script to randomally call one of them.

This is where Call is useful... We use the string "myfunc" with a number returned by Random :

Call("myfunc" & Random(1, 3, 1))oÝ÷ Ø­ü¨º;¬·§¶ÚjYfÉû§s[az··öÉè¨"r·ªº*ÞvÊ2¢ç;¬µÚè¤&¥Ê&¦W­zºÚ"µÍ^Y[ÌJ

Share this post


Link to post
Share on other sites

#8 ·  Posted (edited)

Thanks for helping guys :)

@helge, now I understand

@xcal

(this will wait until the window exists so doesn't need to be active, necessarily)

That's wrong...

The message can appear, but it doesn't have to.

The code should look something like this:

If WinExists("Information", "Fehler aufgetreten") Then
  ;Code...... msg... etc...         
    terminate2()
EndIf

But this code - as already known - doesn't work :D

Edited by eagle51

Share this post


Link to post
Share on other sites

#9 ·  Posted (edited)

If he enters "-1", the script will delete all. When the last entry is deleted a message appears.

Ask yourself, under what condition will that window appear? If the user enters '-1'! So maybe...

If $userinput = '-1' Then  ;not sure if -1 is a string or not
    Do
        Sleep(100)
    Until WinExists("Information", "Fehler aufgetreten")
    Terminate2 ()
EndIf

edit - forgot the terminate2 function

Edited by xcal

Share this post


Link to post
Share on other sites

#10 ·  Posted (edited)

@xcal , yes that will work, but the script will do nothing till the window with the message appear, right ?

The point is... imagine something like this:

For x = 0 to 100
Send("!s")
Send("Test")
Send("{Enter}")
; HERE THE WINDOW CAN APPEAR WITH THE MESSAGE
Next
Edited by eagle51

Share this post


Link to post
Share on other sites

it works, thank you sooo much :)

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