Forum Discussion

joffre's avatar
joffre
Regular Contributor
13 years ago

'object.Enabled' doesn't work properly?

I have the following VBScript code:

Set MenuOcorrencias = Aliases.iexplore.pageFpwebFolhaDePagamento2.frameFrame1.formForm1.panelBarra32.panelMenuCache10.textnodeOcorrNcias



Function AguardarMenuOcorrencias

  While Not MenuOcorrencias.Enabled

    Delay(250)

  Wend

End Function




If the component 'MenuOcorrencias' isn't enabled, my script will delay for 250 ms and try again to find it. The general idea worked. It wasn't enabled so the script tried again, but on Log, it returned an error, saying that
The object does not exist.
.



So, how do I avoid this message? I need to wait the object to be available, as the code says.



Thanks.

2 Replies

  • joffre's avatar
    joffre
    Regular Contributor
    I've tried this way, and it didn't work as well.



    Function AguardarMenuOcorrencias

      While MenuOcorrencias.Enabled <> True

        Delay(250)

      Wend

    End Function
  • joffre's avatar
    joffre
    Regular Contributor
    Just solved the problem, using the .Exists property.



    Function AguardarMenuOcorrencias

      While MenuOcorrencias.Exists <> True

        Delay(250)

      Wend

    End Function