Fry
Joined: 01 Nov 2007 Posts: 885
|
Posted: Wed Feb 10, 2010 4:51 pm Post subject: IE Object within GUI - Page source |
|
|
I have created an IE object within AHK, with COM and I'm trying to get the pages source html.
I've tried locationurl and downloading it, however it does not return the same source as the actual Internet Explorer
May I also say this is a log in website, which gives online tests and Im trying to get the source.
PS: When i use locationurl and download it, it returns this
| Code: |
<h3>Browser Error</h3><br>
The form was not submitted correctly. Click the back button below to try again.<br />
<p align="center">
<a href="javascript:window.history.back()">Back</a><br><br>
Or click below to go to our front page<br><br>
<a href="http://www.studyisland.com">Study Island Home</a>
</p>
|
IE returns a much bigger page with the correct source. |
|
sinkfaze
Joined: 18 Mar 2008 Posts: 5043 Location: the tunnel(?=light)
|
Posted: Wed Feb 10, 2010 5:02 pm Post subject: |
|
|
Perhaps you need to access it from a pointer to the document, try this when the GUI is active:
| Code: | COM_CoInitialize()
ControlGet, hWnd, hWnd, , Internet Explorer_Server1, A
pdoc:=IE_GetDocument(hWnd)
pageSource:=COM_Invoke(pdoc,"documentElement.outerHTML")
MsgBox % pageSource
COM_Release(pdoc)
COM_CoUninitialize()
return
IE_GetDocument(hWnd)
{
Static
If Not pfn
pfn := DllCall("GetProcAddress", "Uint", DllCall("LoadLibrary", "str", "oleacc.dll"), "str", "ObjectFromLresult")
, msg := DllCall("RegisterWindowMessage", "str", "WM_HTML_GETOBJECT")
, COM_GUID4String(iid, "{00020400-0000-0000-C000-000000000046}")
If DllCall("SendMessageTimeout", "Uint", hWnd, "Uint", msg, "Uint", 0, "Uint", 0, "Uint", 2, "Uint", 1000, "UintP", lr:=0) && DllCall(pfn, "Uint", lr, "Uint", &iid, "Uint", 0, "UintP", pdoc:=0)=0
Return pdoc
} |
_________________ Try Quick Search for Autohotkey or see the tutorial for newbies. |
|