You might find it more reliable to use Sean's
COM and GetWebBrowser functions... I'm not sure what you need from the webpage, but it can likely be found just as easy (if not easier) in the source.
This works for me in IE7...
Code:
#NoEnv
#include COM.ahk
#include GetWebBrowser.ahk
`::
Com_Init()
pwb := GetWebBrowser()
gUrl := COM_Invoke(pwb, "LocationURL")
pwbHtml := COM_Invoke(pwb,"document.documentelement.outerHTML")
FileDelete, %A_WorkingDir%\Temp.txt
FileAppend, %gUrl%`n%pwbHtml%, %A_WorkingDir%\Temp.txt
Run, %A_WorkingDir%\Temp.txt
Com_Term()
It's how I would do it anyway.
Sean's GetWebBrowser:
Code:
GetWebBrowser() ; written by Sean
{
ControlGet, hIESvr, hWnd, , Internet Explorer_Server1, ahk_class IEFrame
If Not hIESvr
Return
DllCall("SendMessageTimeout", "Uint", hIESvr, "Uint", DllCall("RegisterWindowMessage", "str", "WM_HTML_GETOBJECT"), "Uint", 0, "Uint", 0, "Uint", 2, "Uint", 1000, "UintP", lResult)
DllCall("oleacc\ObjectFromLresult", "Uint", lResult, "Uint", COM_GUID4String(IID_IHTMLDocument2,"{332C4425-26CB-11D0-B483-00C04FD90119}"), "int", 0, "UintP", pdoc)
IID_IWebBrowserApp := "{0002DF05-0000-0000-C000-000000000046}"
pweb := COM_QueryService(pdoc,IID_IWebBrowserApp,IID_IWebBrowserApp)
COM_Release(pdoc)
Return pweb
}