Issue about imageFound()

Hi All,

Here is what I want to do. I've a processing popup dialog which doesn't have any button. It is only gone when it finished. Therfore, I've implement the simple code below to detect if this popup dialog existed. If so wait until it's gone to perform the next line.

if imageFound("image") then
Wait Until not imageFound("image")
end if

The imageFound("image") keep writing in the log forever until it gone. Is there anyway that I could stop it writing in the log?

Thanks

Best Regards,

Comments

  • SenseTalkDougSenseTalkDoug ForumAdmin admin
    You can turn off logging using the SetLogging OFF command, so you might try this:
    if imageFound("image") then
        SetLogging OFF
        Wait Until not imageFound("image")
        SetLogging ON
    end if 
    

    The Wait Until command is in essence a very tight loop, which will keep your Eggplant machine busy finding that image. If your machine bogs down somewhat while waiting for that image to go away, you might want to let it rest a little in between looking at the remote screen, by changing it like this:
    if imageFound("image") then
        SetLogging OFF
        repeat while imageFound("image")
            wait 0.5 second -- take a short break before checking again
        end repeat
        SetLogging ON
    end if 
    
  • EggplantMattEggplantMatt ForumAdmin admin
    Hi, Buffalo:

    I'd like to add one thing to Doug's response: I don't think there's any need for the "if imageFound()" part of your code. You can just have the "wait until..." line by itself -- if the image isn't found, the "wait until..." will immediately succeed (by not finding the image) in the same amount of time that the "if imagefound()" line will take to fail if the image isn't there. So your code will look like this:
    setLogging off
    Wait Until not imageFound("image")
    setLogging on
    
    or
    repeat while imageFound("image") 
        if loggingIsOn()
           SetLogging OFF
        end if
        wait 0.5 second -- take a short break before checking again 
    end repeat 
    SetLogging ON
    
    This will log that the image either was or wasn't found initially, and then make sure that logging is off for the duration of the loop.

    What you may be trying to accomplish is to first allow some time for the popup to appear before waiting for it to go away, in which case your original code may work because the conditional statement introduces a slight delay while Eggplant looks for the image.
Sign In or Register to comment.