lnTime=12000 && 12 seconds lox=.Null. Release lox Public lox oShell = Createobject("Shell.Application") && A collection of the open windows that belong to the Shell oShellWindows = oShell.Windows For Each oIE In oShellWindows If "IEXPLORE.EXE" $ Justfname(Upper(oIE.FullName)) If 'CLIENT LOGIN'$Upper(oIE.LocationName) lox=oIE llAlredyup=.T. Exit Endif Endif Endfor oShellWindows = Null oShell = Null If !llAlredyup And Vartype(lox)#'O' lox=Createobject('internetexplorer.application') lox.Navigate('http://www.logixonline.co.uk/intcouriers2/newsite/client_login/index.asp') lox.Visible=.T. Wait 'Navigating!' Window Nowait If !NavComplete(lox,lnTime) ??Chr(7) Wait 'Timeout feil!' Window lox.Visible=.F. Release lox Return Endif Wait Clear Endif lox.Visible=.T. declare integer SetForegroundWindow in win32api Integer SetForegroundWindow(lox.HWND) SetForegroundWindow(_vfp.HWNd) If NavComplete(lox,lnTime) lox.Document.All.mainFrame.contentWindow.Document.Forms.login.username.Value='Username' lox.Document.All.mainFrame.contentWindow.Document.Forms.login.passwort.Value="password" lox.document.all.mainFrame.contentWindow.document.forms.login.submit.click() If !NavComplete(lox,lnTime) ??Chr(7) Wait 'timeout error!' Window lox.Visible=.F. Release lox Return Endif endif Function NavComplete Lpara toIE, tnTimeout lnTimeout=Iif( Type("tnTimeout")="N",tnTimeout ,60 ) lnTimeElapsed=0 lnStartSeconds=Seconds() Do While .T. If toIE.ReadyState=4 And !toIE.Busy Do While .T. If toIE.Document.ReadyState="complete" Return .T. Endif If (Seconds()-lnStartSeconds)>lnTimeout Return .F. Endif Enddo Endif If (Seconds()-lnStartSeconds)>lnTimeout Return .F. Endif Enddo