Jump to content

Sky Slate Blueberry Blackcurrant Watermelon Strawberry Orange Banana Apple Emerald Chocolate
Photo

ResolveFrames html - Download full html


  • Please log in to reply
No replies to this topic
IsNull
  • Moderators
  • 990 posts
  • Last active: May 15 2014 11:56 AM
  • Joined: 10 May 2007
Hello,

I've made a lill function by request in the german forum to download the full html of a site when frames are used.
The Function recursively downloads all Frames (html) and does a inline replacement - like every browser does.

Requires latest httpQuery in stdLib.

ResolveFrames(url)
/***********************************************************
ResolveFrames(url)
by IsNull 2010

Downloads the full site html, including all frame html.
************************************************************
*/
ResolveFrames(url){
   frameNeedle = (<frame .*? src="(.*?)".*?>)
   
   if(A_IsUnicode){
      MsgBox,16, Wrong Interpreter, NotCompatibleInterpreterException: Unicode is not supportet!`nReason: HttpQuery() currently doesn't support unicode build. 
      ExitApp
   }
   
   if(-1 == (html := HttpQuery(url))) ; requires latest version! 
      return ""
   
   pos := 1     
   while(pos := RegExMatch(html,frameNeedle, out, pos)){
      frame_html := ResolveFrames(out2)
      html := RegExReplace(html, frameNeedle, frame_html, replacementCnt, 1, pos)
      pos += (frame_html != "") ? strLen(frame_html) : strLen(out)
   }
   return html
}

I hope HttpQuery() becomes officaly unicode stable to support those builds too.