AutoHotkey Homepage AutoHotkey Community
Let's help each other out
 
 FAQFAQ   SearchSearch   MemberlistMemberlist   RegisterRegister 
 ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 

IE Object within GUI - Page source

 
Reply to topic    AutoHotkey Community Forum Index -> Ask for Help
View previous topic :: View next topic  
Author Message
Fry



Joined: 01 Nov 2007
Posts: 885

PostPosted: Wed Feb 10, 2010 4:51 pm    Post subject: IE Object within GUI - Page source Reply with quote

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.
Back to top
View user's profile Send private message
sinkfaze



Joined: 18 Mar 2008
Posts: 5043
Location: the tunnel(?=light)

PostPosted: Wed Feb 10, 2010 5:02 pm    Post subject: Reply with quote

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.
Back to top
View user's profile Send private message Send e-mail
Display posts from previous:   
Reply to topic    AutoHotkey Community Forum Index -> Ask for Help All times are GMT
Page 1 of 1

 
Jump to:  
You can post new topics in this forum
You can reply to topics in this forum


Powered by phpBB © 2001, 2005 phpBB Group