| View previous topic :: View next topic |
| Author |
Message |
silkcom
Joined: 23 Jan 2008 Posts: 154
|
Posted: Tue Oct 28, 2008 5:04 pm Post subject: Watching Firefox's current page (only for IE) |
|
|
Is there a way to find a current firefox window by title, and get the html code from the page?
Last edited by silkcom on Wed Jan 07, 2009 9:25 pm; edited 3 times in total |
|
| Back to top |
|
 |
hugov
Joined: 27 May 2007 Posts: 2448
|
|
| Back to top |
|
 |
silkcom
Joined: 23 Jan 2008 Posts: 154
|
Posted: Tue Oct 28, 2008 5:27 pm Post subject: |
|
|
| is there a way to read in the html that's there without redownloading the file? It would also be nice to be able to pull in image files that are already there without redownloading them (but not as necisary). |
|
| Back to top |
|
 |
John W
Joined: 09 Apr 2007 Posts: 172
|
Posted: Tue Oct 28, 2008 5:38 pm Post subject: |
|
|
There should be a hotkey in FF to view the source.
Try this: Send the Hotkey, mark everything, save clipboard, copy to clipboard, read from clipboard, restore clipboard, use the html source.
| Code: | oldClip:=ClipboardAll
SendInput, <viewsource>^a^c
ClipWait, 3000
HTML=%Clipboard%
Clipboard:=oldClip |
_________________ COMPLETELY INACTIVE - I do not use AHK anymore. |
|
| Back to top |
|
 |
silkcom
Joined: 23 Jan 2008 Posts: 154
|
Posted: Tue Oct 28, 2008 5:42 pm Post subject: |
|
|
| hmm, i'd prefer to do this in the background. Basically there's a site that changes semi regularly, and i only want to know about it when it changes, otherwise it can sit in the background. There are several things I want to know about it, so the source is my best bet in rummaging through and creating logs etc. |
|
| Back to top |
|
 |
hugov
Joined: 27 May 2007 Posts: 2448
|
|
| Back to top |
|
 |
silkcom
Joined: 23 Jan 2008 Posts: 154
|
Posted: Tue Oct 28, 2008 6:01 pm Post subject: |
|
|
sorry to be a pain, however, the site is constantly changing. Every minute something changes. There are only a few changes that I want to know about. There are things that I wish to log, but those should be done in the background. But this update scanner is very similar to what i want to do. |
|
| Back to top |
|
 |
silkcom
Joined: 23 Jan 2008 Posts: 154
|
Posted: Tue Oct 28, 2008 10:20 pm Post subject: |
|
|
| Is it even possible to grab the HTML code from the current FireFox (really any browser would work) window? I know it has the HTML code, and I know that when you view source it doesn't go and regrab it. I'd be ok with a link to the DOM tree, anything that will let me parse through the page as it currently looks. |
|
| Back to top |
|
 |
tank
Joined: 21 Dec 2007 Posts: 2413 Location: Louisville KY USA
|
Posted: Wed Oct 29, 2008 2:00 am Post subject: |
|
|
| silkcom wrote: | | Is it even possible to grab the HTML code from the current FireFox (really any browser would work) window? I know it has the HTML code, and I know that when you view source it doesn't go and regrab it. I'd be ok with a link to the DOM tree, anything that will let me parse through the page as it currently looks. |
firefox - No not with ahk
IE yes UrlDownloadToVar _________________ Basic Webpage Controls with JavaScript / COM - Tutorial by Jethrow
 |
|
| Back to top |
|
 |
tank
Joined: 21 Dec 2007 Posts: 2413 Location: Louisville KY USA
|
Posted: Wed Oct 29, 2008 2:54 am Post subject: |
|
|
| Code: | hIESvr:=winexist("A")
WinGetClass, class, ahk_id %hIESvr%
if (!hIESvr or class != "Internet Explorer_Server")
{
MsgBox, Control "Internet Explorer_Server" not found.
Return
}
COM_CoInitialize()
WM_HTML_GETOBJECT := DllCall("RegisterWindowMessage", "str", "WM_HTML_GETOBJECT")
SendMessage, WM_HTML_GETOBJECT,,,, ahk_id %hIESvr%
lResult := ErrorLevel
DllCall("oleacc\ObjectFromLresult", "uint", lResult
, "uint", COM_GUID4String(IID_IHTMLDocument2,"{332C4425-26CB-11D0-B483-00C04FD90119}")
, "int", 0, "uint*", pDoc)
msgbox % htmlcode:=COM_Invoke(DocEle:=COM_Invoke(pDoc, "documentElement") ,"innerHTML" )
innerHTML )
COM_CoUninitialize()
exitapp | You will need the latest version of com and to call this while a page is active you can similarly use the htmlcode as a string to parse but i wonder why you would bother using ti as text instead of using DOM on it _________________ Basic Webpage Controls with JavaScript / COM - Tutorial by Jethrow
 |
|
| Back to top |
|
 |
silkcom
Joined: 23 Jan 2008 Posts: 154
|
Posted: Wed Oct 29, 2008 4:43 pm Post subject: |
|
|
How sure are you that it's not possible in firefox? I really would prefer firefox. All i need is simply to find the correct window (by address or title), and get the html into a string. I can work with it from there.
It would be just as good to get the dom into an object. |
|
| Back to top |
|
 |
tank
Joined: 21 Dec 2007 Posts: 2413 Location: Louisville KY USA
|
|
| Back to top |
|
 |
evan Guest
|
Posted: Wed Oct 29, 2008 6:46 pm Post subject: |
|
|
whats wrong with redownloading the html?
even there are hundreds of images and videos inside the site
when u download the html down, all it is is just a TXT file showing many image/video links |
|
| Back to top |
|
 |
silkcom
Joined: 23 Jan 2008 Posts: 154
|
Posted: Wed Oct 29, 2008 7:04 pm Post subject: |
|
|
| It's a site full of ajax. So i'm not sure that downloading the html file again would give me what is currently showing in firefox |
|
| Back to top |
|
 |
tank
Joined: 21 Dec 2007 Posts: 2413 Location: Louisville KY USA
|
Posted: Wed Oct 29, 2008 9:08 pm Post subject: |
|
|
pretty much garantee it wouldnt
Guess your going to have to use soemthing like iMacros or use IE for your automated html grabbing by the way the problem with firefox is with getting the HTML via AHK there is simply no way short of some problematic sending of ctrl f and ctrl to copy and get the text from the page but even that wouldnt get you the HTML _________________ Basic Webpage Controls with JavaScript / COM - Tutorial by Jethrow
 |
|
| Back to top |
|
 |
|