GLOBAL IE AS OBJECT GLOBAL oIE AS OBJECT IE = _IECreate("www.yahoo.com",1,0) Delay 5 '2 _IENavigate(IE,"www.google.com") Delay 5 _IEQuit(IE) SET oIE = Nothing SET IE = Nothing END '=============================================================================== ' ' Function Name: _IECreate() ' Description: Create an Internet Explorer Browser Window ' Parameter(s): $s_Url - Optional: specifies the Url to navigate to upon creation ' ' $f_visible - Optional: specifies whether the browser window will be visible ' 0 = Browser Window is hidden ' 1 = (Default) Browser Window is visible ' $f_wait - Optional: specifies whether to wait for page to load before returning ' 0 = Return immediately, not waiting for page to load ' 1 = (Default) Wait for page load to complete before returning ' Return Value(s): On Success - Returns an object variable pointing to an InternetExplorer.Application object ' On Failure - Returns 0 and sets @ERROR ' Author(s): Thatsgreat2345 ' '=============================================================================== ' FUNCTION _IECreate OPTIONAL(s_URL$,f_visible%=1,f_wait% = 0) AS OBJECT SET oIE = CREATEOBJECT("InternetExplorer.Application") IF BCX_COM_ERROR THEN RETURN 0 END IF IF f_visible THEN oIE.visible = true ELSE oIE.visible = false END IF _IENavigate(oIE,s_URL$,f_wait) FUNCTION = oIE END FUNCTION '=============================================================================== ' ' Function Name: _IENavigate() ' Description: Directs an existing browser window to navigate to the specified URL ' Parameter(s): $o_object - Object variable of an InternetExplorer.Application, ' Window or Frame object ' $s_Url - URL to navigate to (e.g. "http://www.autoitscript.com") ' $f_wait - Optional: specifies whether to wait for page to load ' before returning ' 0 = Return immediately, not waiting for page to load ' 1 = (Default) Wait for page load to complete before returning ' Author(s): Thatsgreat2345 '=============================================================================== FUNCTION _IENavigate OPTIONAL (oIE AS OBJECT ,s_URL$,f_wait% =0) oIE.Navigate s_URL$ IF f_wait THEN _IELoadWait(oIE,300) END IF FUNCTION = 0 END FUNCTION '=============================================================================== ' ' Function Name: _IELoadWait() ' Description: Wait for a browser page load to complete before returning ' Parameter(s): $o_object - Object variable of an InternetExplorer.Application ' $i_timeout - Optional: Period of time to wait before exiting ' function (default = 300s aka 5 m) ' Author(s): Thatsgreat2345' '=============================================================================== '$COMMENT 'I'm not sure which of these 2 functions is the best, Ian FUNCTION _IELoadWait(oIE AS OBJECT ,i_timeout%) Dim Waiting FOR INTEGER i = 1 TO i_timeout oIE.Busy Waiting IF Waiting <> 0 THEN DELAY 1 ELSE EXIT LOOP END IF NEXT FUNCTION = 0 END FUNCTION $COMMENT FUNCTION _IELoadWait(oIE AS OBJECT ,i_timeout%) Dim Ready FOR INTEGER i = 1 TO i_timeout oIE.ReadyState Ready IF Ready <> READYSTATE_COMPLETE THEN '4 DELAY 1 ELSE EXIT LOOP END IF NEXT END FUNCTION $COMMENT Function _IEQuit(oIE AS OBJECT ) oIE.Quit FUNCTION = 0 END FUNCTION