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 

Watching Firefox's current page (only for IE)
Goto page Previous  1, 2, 3  Next
 
Post new topic   Reply to topic    AutoHotkey Community Forum Index -> Ask for Help
View previous topic :: View next topic  
Author Message
silkcom



Joined: 23 Jan 2008
Posts: 154

PostPosted: Wed Oct 29, 2008 9:32 pm    Post subject: Reply with quote

is it possible to get anything from the page in a way that doesn't require the page to be active? It would be ok if I couldn't get the html, but any text showing ont he page would be enough. I just don't want tht page to become active to get the text.
Back to top
View user's profile Send private message
tank



Joined: 21 Dec 2007
Posts: 2413
Location: Louisville KY USA

PostPosted: Wed Oct 29, 2008 10:58 pm    Post subject: Reply with quote

no not with firefox with IE yes
_________________
Basic Webpage Controls with JavaScript / COM - Tutorial by Jethrow
Back to top
View user's profile Send private message
silkcom



Joined: 23 Jan 2008
Posts: 154

PostPosted: Wed Oct 29, 2008 11:17 pm    Post subject: Reply with quote

so using your code all i get is Control "Internet Explorer_Server" not found.
Back to top
View user's profile Send private message
tank



Joined: 21 Dec 2007
Posts: 2413
Location: Louisville KY USA

PostPosted: Thu Oct 30, 2008 2:41 am    Post subject: Reply with quote

sorry sometimes i dont pay attention when i put swcripts together i tested this one
Code:
F3::
ControlGet, hIESvr, Hwnd,, Internet Explorer_Server1,A ahk_class IEFrame
    WinGetClass, class, ahk_id %hIESvr%
;~ MsgBox   % class
    if (!hIESvr or class != "Internet Explorer_Server")
   {
      MsgBox, Control "Internet Explorer_Server" not found.
exitapp
      }
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")
COM_CoUninitialize()
exitapp

_________________
Basic Webpage Controls with JavaScript / COM - Tutorial by Jethrow
Back to top
View user's profile Send private message
silkcom



Joined: 23 Jan 2008
Posts: 154

PostPosted: Thu Oct 30, 2008 4:58 am    Post subject: Reply with quote

hmmm, maybe i still have it wrong. I did the import at the top with the com library you have in your signature. I then pasted what you gave there, opened up IE, and hit f3. Still same message.
Back to top
View user's profile Send private message
tank



Joined: 21 Dec 2007
Posts: 2413
Location: Louisville KY USA

PostPosted: Thu Oct 30, 2008 3:11 pm    Post subject: Reply with quote

obviously the IE must be the active window when you hit f3?
_________________
Basic Webpage Controls with JavaScript / COM - Tutorial by Jethrow
Back to top
View user's profile Send private message
silkcom



Joined: 23 Jan 2008
Posts: 154

PostPosted: Thu Oct 30, 2008 3:14 pm    Post subject: Reply with quote

ya, it was.
Back to top
View user's profile Send private message
tank



Joined: 21 Dec 2007
Posts: 2413
Location: Louisville KY USA

PostPosted: Thu Oct 30, 2008 3:34 pm    Post subject: Reply with quote

works on my vista with IE7
_________________
Basic Webpage Controls with JavaScript / COM - Tutorial by Jethrow
Back to top
View user's profile Send private message
silkcom



Joined: 23 Jan 2008
Posts: 154

PostPosted: Thu Oct 30, 2008 4:24 pm    Post subject: Reply with quote

hmm, XP version 6. I wonder if there's a different name for IE 6 in XP
Back to top
View user's profile Send private message
tank



Joined: 21 Dec 2007
Posts: 2413
Location: Louisville KY USA

PostPosted: Fri Oct 31, 2008 2:42 am    Post subject: Reply with quote

you can try and see if this also tested gives you better results
Code:
F3::
COM_CoInitialize()
IID_IHTMLWindow2      :=   "{332C4427-26CB-11D0-B483-00C04FD90119}"
pwin             :=   COM_QueryService(pwb:=getwin(),   IID_IHTMLWindow2,   IID_IHTMLWindow2)
pDoc   :=   COM_Invoke(pwin,   "Document")
msgbox % htmlcode:=COM_Invoke(DocEle:=COM_Invoke(pDoc, "documentElement") ,"innerHTML")
COM_CoUninitialize()
exitapp
getwin(t="")
{
    if t=
        WinGetTitle,t,ahk_class IEFrame
        StringSplit,tt,t,-
        StringTrimRight,t,tt1,1
   Loop, %   COM_Invoke(psw   :=   COM_Invoke(psh   :=   COM_CreateObject("Shell.Application"),   "Windows"),   "Count")
   {
      LocationName   :=   COM_Invoke(pwb   :=   COM_Invoke(psw,   "Item",   A_Index-1),   "LocationName")
       IfInString,LocationName,%t%
      {
         COM_Release(psw),   VarSetCapacity(psw,   0),   COM_Release(psh),   VarSetCapacity(psh,   0)
         Return   pwb   
      }
      COM_Release(pwb),   VarSetCapacity(pwb,   0) ;didnt break so release the one we didnt use
   }
   COM_Release(psw),   VarSetCapacity(psw,   0),   COM_Release(psh),   VarSetCapacity(psh,   0)
   Return   0
}

_________________
Basic Webpage Controls with JavaScript / COM - Tutorial by Jethrow
Back to top
View user's profile Send private message
silkcom



Joined: 23 Jan 2008
Posts: 154

PostPosted: Fri Oct 31, 2008 3:19 pm    Post subject: Reply with quote

lol, this is an illusive one

Function Name: "LocationName"
Error: The COM Object may not be a valid one!
()

However, it does give me the html code. So it seems as if the LocationName is the only problem.

Ok, what are the possibilities of changing the script so that when F3 is hit it looks for an IE window that has a set location. Instead of having to have IE active.
Back to top
View user's profile Send private message
tank



Joined: 21 Dec 2007
Posts: 2413
Location: Louisville KY USA

PostPosted: Fri Oct 31, 2008 3:37 pm    Post subject: Reply with quote

set location based on what
add COM_Error(0) after the COM_CoInitialize()
i can assure you its a valid COM object you got somethin pretty special goin on on that PC
we can pas a title to getwin(t="") or we can alter the function to use soem other criteria but your going to need to be more specific about what that criteria is
_________________
Basic Webpage Controls with JavaScript / COM - Tutorial by Jethrow
Back to top
View user's profile Send private message
silkcom



Joined: 23 Jan 2008
Posts: 154

PostPosted: Fri Oct 31, 2008 6:41 pm    Post subject: Reply with quote

Really i just want to find the IE based on the website it's at. Once I find the right one then i'm set. That way I can put it on a 30 second timer and parse through the html.

By the way, thanks for all the help, it really is appreciated.
Back to top
View user's profile Send private message
tank



Joined: 21 Dec 2007
Posts: 2413
Location: Louisville KY USA

PostPosted: Fri Oct 31, 2008 6:55 pm    Post subject: Reply with quote

silkcom wrote:
Really i just want to find the IE based on the website it's at. Once I find the right one then i'm set. That way I can put it on a 30 second timer and parse through the html.

By the way, thanks for all the help, it really is appreciated.

Code:
F3::
COM_CoInitialize()
COM_Error(0)
IID_IHTMLWindow2      :=   "{332C4427-26CB-11D0-B483-00C04FD90119}"
pwin             :=   COM_QueryService(pwb:=getwinbyURL("http://url.com"),   IID_IHTMLWindow2,   IID_IHTMLWindow2)
pDoc   :=   COM_Invoke(pwin,   "Document")
msgbox % htmlcode:=COM_Invoke(DocEle:=COM_Invoke(pDoc, "documentElement") ,"innerHTML")
COM_CoUninitialize()
exitapp
getwinbyURL(url)
{
       Loop, %   COM_Invoke(psw   :=   COM_Invoke(psh   :=   COM_CreateObject("Shell.Application"),   "Windows"),   "Count")
   {
      LocationURL:=   COM_Invoke(pwb   :=   COM_Invoke(psw,   "Item",   A_Index-1),   "LocationURL")
       IfInString,LocationURL,%url%
      {
         COM_Release(psw),   VarSetCapacity(psw,   0),   COM_Release(psh),   VarSetCapacity(psh,   0)
         Return   pwb   
      }
      COM_Release(pwb),   VarSetCapacity(pwb,   0) ;didnt break so release the one we didnt use
   }
   COM_Release(psw),   VarSetCapacity(psw,   0),   COM_Release(psh),   VarSetCapacity(psh,   0)
   Return   0
}

_________________
Basic Webpage Controls with JavaScript / COM - Tutorial by Jethrow
Back to top
View user's profile Send private message
silkcom



Joined: 23 Jan 2008
Posts: 154

PostPosted: Fri Oct 31, 2008 9:24 pm    Post subject: Reply with quote

Excellent, now I just need to go through an loop on a timer or something and parse through the html. Thank you, answered.
Back to top
View user's profile Send private message
Display posts from previous:   
Post new topic   Reply to topic    AutoHotkey Community Forum Index -> Ask for Help All times are GMT
Goto page Previous  1, 2, 3  Next
Page 2 of 3

 
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