 |
AutoHotkey Community Let's help each other out
|
| View previous topic :: View next topic |
| Author |
Message |
silkcom
Joined: 23 Jan 2008 Posts: 154
|
Posted: Wed Oct 29, 2008 9:32 pm Post subject: |
|
|
| 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 |
|
 |
tank
Joined: 21 Dec 2007 Posts: 2413 Location: Louisville KY USA
|
|
| Back to top |
|
 |
silkcom
Joined: 23 Jan 2008 Posts: 154
|
Posted: Wed Oct 29, 2008 11:17 pm Post subject: |
|
|
| so using your code all i get is Control "Internet Explorer_Server" not found. |
|
| Back to top |
|
 |
tank
Joined: 21 Dec 2007 Posts: 2413 Location: Louisville KY USA
|
Posted: Thu Oct 30, 2008 2:41 am Post subject: |
|
|
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 |
|
 |
silkcom
Joined: 23 Jan 2008 Posts: 154
|
Posted: Thu Oct 30, 2008 4:58 am Post subject: |
|
|
| 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 |
|
 |
tank
Joined: 21 Dec 2007 Posts: 2413 Location: Louisville KY USA
|
|
| Back to top |
|
 |
silkcom
Joined: 23 Jan 2008 Posts: 154
|
Posted: Thu Oct 30, 2008 3:14 pm Post subject: |
|
|
| ya, it was. |
|
| Back to top |
|
 |
tank
Joined: 21 Dec 2007 Posts: 2413 Location: Louisville KY USA
|
|
| Back to top |
|
 |
silkcom
Joined: 23 Jan 2008 Posts: 154
|
Posted: Thu Oct 30, 2008 4:24 pm Post subject: |
|
|
| hmm, XP version 6. I wonder if there's a different name for IE 6 in XP |
|
| Back to top |
|
 |
tank
Joined: 21 Dec 2007 Posts: 2413 Location: Louisville KY USA
|
Posted: Fri Oct 31, 2008 2:42 am Post subject: |
|
|
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 |
|
 |
silkcom
Joined: 23 Jan 2008 Posts: 154
|
Posted: Fri Oct 31, 2008 3:19 pm Post subject: |
|
|
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 |
|
 |
tank
Joined: 21 Dec 2007 Posts: 2413 Location: Louisville KY USA
|
Posted: Fri Oct 31, 2008 3:37 pm Post subject: |
|
|
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 |
|
 |
silkcom
Joined: 23 Jan 2008 Posts: 154
|
Posted: Fri Oct 31, 2008 6:41 pm Post subject: |
|
|
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 |
|
 |
tank
Joined: 21 Dec 2007 Posts: 2413 Location: Louisville KY USA
|
Posted: Fri Oct 31, 2008 6:55 pm Post subject: |
|
|
| 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 |
|
 |
silkcom
Joined: 23 Jan 2008 Posts: 154
|
Posted: Fri Oct 31, 2008 9:24 pm Post subject: |
|
|
| 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 |
|
 |
|
|
You can post new topics in this forum You can reply to topics in this forum
|
Powered by phpBB © 2001, 2005 phpBB Group
|