pURL="https://fortress.wa.gov/dol/ddl/dsd/" license="ABCDEFG123AX" clear READYSTATE_COMPLETE = 4 MAX_TIME =60 lcSendKey="" llok=.f. oIE = CreateObject("InternetExplorer.Application") oIE.visible=.t. oIE.Navigate(pURL) lnWaiting=MAX_TIME lnStarted = SECONDS() do while oIE.Readystate <> READYSTATE_COMPLETE OR oie.busy lnWaiting = Seconds() - lnStarted IF lnWaiting >= MAX_TIME oIE=null =MESSAGEBOX("unable to connect, timeout...") return ENDIF ENDDO WITH oie.Document.getElementsByTagname("td") IF .length >=1 FOR ia=0 TO .length-1 IF TYPE(".Item(ia).innerhtml")="C" and ; [javascript:navigate('login','0')]$.Item(ia).innerhtml .Item(ia).all.Item(1).click llok=.t. endif ENDFOR endif ENDWITH IF NOT llok oIE=null =MESSAGEBOX("unable to find/click the 'start application' control ...") return ENDIF llok=.f. lnStarted = SECONDS() &&second page do while oIE.Readystate <> READYSTATE_COMPLETE OR oie.busy lnWaiting = Seconds() - lnStarted IF lnWaiting >= MAX_TIME oIE=null =MESSAGEBOX("unable to review the second page, timeout...") return ENDIF ENDDO IF TYPE([oie.Document.getelementsbyname("txtPICNumber").Item(0)])="O" oie.Document.getelementsbyname("txtPICNumber").Item(0).value=license ELSE oIE=null =MESSAGEBOX("unable to find the INPUT box...") return endif WITH oie.Document.getElementsByTagname("A") IF .length >=1 FOR ia=0 TO .length-1 IF TYPE(".Item(ia).innerhtml")="C" and ; [continue]$LOWER(.Item(ia).innerhtml) .Item(ia).click endif ENDFOR endif ENDWITH oie=null return