Jump to content

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


eagle51
 Share

Recommended Posts

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]

Link to comment
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

Link to comment
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()

Link to comment
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
Link to comment
Share on other sites

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
Link to comment
Share on other sites

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
Link to comment
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
 Share

  • Recently Browsing   0 members

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