• Creator
  • #4318

    I need to pause a script to allow a web page to finish downloading so I can reference the document object. The do loop in the following code doesn’t work – it causes the script to hang as if in an infinite loop. Does anyone have any suggestions?

    Set ps = GroupWise.PortalManager.Portals
    Set p = ps.Add
    p.Caption = “eWeber Test”
    p.TabCaption = “eWeber”
    p.ID = “p1”
    p.NavigationControlsEnabled = True
    p.URLInputEnabled = True
    p.URL = “http://weber.edu/eWeberTest”

    do until nReady = 4
    nReady = p.ReadyState

    set oDoc = p.document

  • Author
  • #7807
    Support 3

    You can use the utilities.Timer inside the loop to wait for the seconds specified. For example, uilities.Timer(1) will wait for a second.

    I also will recommend to use the utilities.DoEvents inside the loop to process any pending messages in the Windows application message queue. Its also a good idea not to run the loop indefinitely, have some sort of exit strategery. For example, exit the loop after some number of attempts.

    See the Formativ language guide for more information about the Utilities object and its properties.

    Hope this helps.

    Advansys Support

Viewing 1 replies (of 1 total)
  • You must be logged in to reply to this topic.