AutoHotkey Community

It is currently May 26th, 2012, 11:10 am

All times are UTC [ DST ]




Post new topic Reply to topic  [ 45 posts ]  Go to page Previous  1, 2, 3  Next
Author Message
 Post subject:
PostPosted: October 29th, 2008, 9:32 pm 
Offline

Joined: January 23rd, 2008, 6:38 pm
Posts: 162
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.


Report this post
Top
 Profile  
Reply with quote  
 Post subject:
PostPosted: October 29th, 2008, 10:58 pm 
Offline
User avatar

Joined: December 21st, 2007, 3:14 pm
Posts: 3826
Location: Louisville KY USA
no not with firefox with IE yes

_________________
No matter what your oppinion Please join this discussion
Formal request to Polyethene
Image


Report this post
Top
 Profile  
Reply with quote  
 Post subject:
PostPosted: October 29th, 2008, 11:17 pm 
Offline

Joined: January 23rd, 2008, 6:38 pm
Posts: 162
so using your code all i get is Control "Internet Explorer_Server" not found.


Report this post
Top
 Profile  
Reply with quote  
 Post subject:
PostPosted: October 30th, 2008, 2:41 am 
Offline
User avatar

Joined: December 21st, 2007, 3:14 pm
Posts: 3826
Location: Louisville KY USA
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

_________________
No matter what your oppinion Please join this discussion
Formal request to Polyethene
Image


Report this post
Top
 Profile  
Reply with quote  
 Post subject:
PostPosted: October 30th, 2008, 4:58 am 
Offline

Joined: January 23rd, 2008, 6:38 pm
Posts: 162
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.


Report this post
Top
 Profile  
Reply with quote  
 Post subject:
PostPosted: October 30th, 2008, 3:11 pm 
Offline
User avatar

Joined: December 21st, 2007, 3:14 pm
Posts: 3826
Location: Louisville KY USA
obviously the IE must be the active window when you hit f3?

_________________
No matter what your oppinion Please join this discussion
Formal request to Polyethene
Image


Report this post
Top
 Profile  
Reply with quote  
 Post subject:
PostPosted: October 30th, 2008, 3:14 pm 
Offline

Joined: January 23rd, 2008, 6:38 pm
Posts: 162
ya, it was.


Report this post
Top
 Profile  
Reply with quote  
 Post subject:
PostPosted: October 30th, 2008, 3:34 pm 
Offline
User avatar

Joined: December 21st, 2007, 3:14 pm
Posts: 3826
Location: Louisville KY USA
works on my vista with IE7

_________________
No matter what your oppinion Please join this discussion
Formal request to Polyethene
Image


Report this post
Top
 Profile  
Reply with quote  
 Post subject:
PostPosted: October 30th, 2008, 4:24 pm 
Offline

Joined: January 23rd, 2008, 6:38 pm
Posts: 162
hmm, XP version 6. I wonder if there's a different name for IE 6 in XP


Report this post
Top
 Profile  
Reply with quote  
 Post subject:
PostPosted: October 31st, 2008, 2:42 am 
Offline
User avatar

Joined: December 21st, 2007, 3:14 pm
Posts: 3826
Location: Louisville KY USA
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
}

_________________
No matter what your oppinion Please join this discussion
Formal request to Polyethene
Image


Report this post
Top
 Profile  
Reply with quote  
 Post subject:
PostPosted: October 31st, 2008, 3:19 pm 
Offline

Joined: January 23rd, 2008, 6:38 pm
Posts: 162
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.


Report this post
Top
 Profile  
Reply with quote  
 Post subject:
PostPosted: October 31st, 2008, 3:37 pm 
Offline
User avatar

Joined: December 21st, 2007, 3:14 pm
Posts: 3826
Location: Louisville KY USA
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

_________________
No matter what your oppinion Please join this discussion
Formal request to Polyethene
Image


Report this post
Top
 Profile  
Reply with quote  
 Post subject:
PostPosted: October 31st, 2008, 6:41 pm 
Offline

Joined: January 23rd, 2008, 6:38 pm
Posts: 162
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.


Report this post
Top
 Profile  
Reply with quote  
 Post subject:
PostPosted: October 31st, 2008, 6:55 pm 
Offline
User avatar

Joined: December 21st, 2007, 3:14 pm
Posts: 3826
Location: Louisville KY USA
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
}

_________________
No matter what your oppinion Please join this discussion
Formal request to Polyethene
Image


Report this post
Top
 Profile  
Reply with quote  
 Post subject:
PostPosted: October 31st, 2008, 9:24 pm 
Offline

Joined: January 23rd, 2008, 6:38 pm
Posts: 162
Excellent, now I just need to go through an loop on a timer or something and parse through the html. Thank you, answered.


Report this post
Top
 Profile  
Reply with quote  
Display posts from previous:  Sort by  
Post new topic Reply to topic  [ 45 posts ]  Go to page Previous  1, 2, 3  Next

All times are UTC [ DST ]


Who is online

Users browsing this forum: No registered users and 55 guests


You can post new topics in this forum
You can reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot post attachments in this forum

Search for:
Powered by phpBB® Forum Software © phpBB Group