Forum Discussion

paarmann-ara's avatar
paarmann-ara
Contributor
6 years ago
Solved

wItemCount and WaitProperty

I have Qustion about WaitProperty!

I want know, may I use a Secound Parameter of WaitProperty like a boolian or how can I?

 

like:

Object.WaitProperty(wItemCount, wItemCount > 0)

14 Replies

  • As far as I know, there is no way to do this.  You should however be able to just put in a basic for loop and test the property directly:

     

    var itemsFound = fasle;
    for(var I=0;i<100;i++){
    if(Object.wItemsCount >0)
    itemsFound  = true;
    break;
    Delay(1000);
    Object.Refresh(); //Might be required, but not guaranteed } if(!itemsFound){ Log.Error("No items found in allotted time"); }
    • paarmann-ara's avatar
      paarmann-ara
      Contributor

      Many thanks for your reply.

      I want to use this method to solve a error (window handel exsist but window not). that's not help me :-(

      • RUDOLF_BOTHMA's avatar
        RUDOLF_BOTHMA
        Community Hero

        In that case, you could use the .Exists rather than trying to use a property of the object which may or may not exist

        e.g.

         

        var objtectExists=false;
        var counter = 0;
        
        while(counter<100 && !objectExists)
        {
        counter++;
        if(Object.Exists)
        {
        objectExists = true;
        break;
        }else
        {
        Delay(100);
        ObjectParent.Refresh(); ObjectParent.FindChild("objectname"); //Or similar find method
        // } }