 |
AutoHotkey Community Let's help each other out
|
| View previous topic :: View next topic |
| Author |
Message |
Mike" Guest
|
Posted: Sat Apr 05, 2008 7:30 am Post subject: |
|
|
Thanks Lexikos  |
|
| Back to top |
|
 |
phil81uk
Joined: 05 Jul 2008 Posts: 6
|
Posted: Sat Jul 05, 2008 10:31 am Post subject: Great, but how do I use it :) |
|
|
Hello,
How do I use this function?
I've clicked a link in a webpage which should load the next page. How do I now use ieready() to check that the new page is loaded?
And if it doesn't load then I want another function to execute (to restart the script). How do I do this? |
|
| Back to top |
|
 |
Sean
Joined: 12 Feb 2007 Posts: 2462
|
Posted: Sat Jul 05, 2008 2:43 pm Post subject: Re: Great, but how do I use it :) |
|
|
| phil81uk wrote: | | I've clicked a link in a webpage which should load the next page. How do I now use ieready() to check that the new page is loaded? | Run the script shortly after clicking the link. |
|
| Back to top |
|
 |
tank
Joined: 21 Dec 2007 Posts: 3700 Location: Louisville KY USA
|
Posted: Sun Aug 24, 2008 5:56 pm Post subject: |
|
|
i find it is best after triggering a click event to sleep 500 before doing any readystate checks. but i have a very slow machine _________________
We are troubled on every side‚ yet not distressed; we are perplexed‚
but not in despair; Persecuted‚ but not forsaken; cast down‚ but not destroyed; |
|
| Back to top |
|
 |
Yetti
Joined: 18 Dec 2008 Posts: 6
|
Posted: Thu Dec 18, 2008 4:54 pm Post subject: |
|
|
| hotzenpl0tz wrote: | Hm thanks, but I have to admit that I couldn't find the part relevant to my problem. I saw the following code you suggested:
| Code: |
#Include CoHelper.ahk
F12::
CoInitialize()
pie := ActiveXObject("InternetExplorer.Application")
Invoke(pie, "Visible=", "True")
Invoke(pie, "Navigate", "http://maps.google.ca/maps?ie=UTF-8&oe=UTF-8&hl=en&tab=wl&q=")
Loop
{
If Invoke(pie, "ReadyState") = 4
Break
Sleep, 500
}
Release(pie)
CoUninitialize()
Run, calc.exe
Return
|
|
How to receive property Document For example on AutoIt it would look so:
| Quote: | $objIE = ObjCreate("InternetExplorer.Application")
With $objIE
.Visible = True
.Navigate("http://mail.ru/")
While .Busy
Sleep(200)
Wend
EndWith
$objForm = $objIE.Document.forms("Auth")
With $objForm
.elements("Login").value = "Vasya"
.elements("Domain").value = "bk.ru"
.elements("Password").value = "111"
EndWith |
I have made by means of CoHelper.ahk the following:
| Code: | #Include CoHelper.ahk
CoInitialize()
pie := ActiveXObject("InternetExplorer.Application")
Invoke(pie, "Visible=", "True")
Invoke(pie, "Navigate", "http://mail.ru/")
Release(pie)
CoUninitialize() |
That I do not know further...: ( |
|
| Back to top |
|
 |
tank
Joined: 21 Dec 2007 Posts: 3700 Location: Louisville KY USA
|
Posted: Thu Dec 18, 2008 6:46 pm Post subject: |
|
|
| Code: | #Include CoHelper.ahk
CoInitialize()
pie := ActiveXObject("InternetExplorer.Application")
Invoke(pie, "Visible=", "True")
Invoke(pie, "Navigate", "http://mail.ru/")
Loop
{
If Invoke(pie, "ReadyState") = 4
Break
Sleep, 500
}
doc:=Invoke(pie, "Document")
;; hurrah you have a document pointer
Release(pie)
CoUninitialize() |
While i tend to use exclusively the com library the syntax and methods are pretty much identical except in a few isolated instances. you can check my sig for some very complete walk thrus _________________
We are troubled on every side‚ yet not distressed; we are perplexed‚
but not in despair; Persecuted‚ but not forsaken; cast down‚ but not destroyed; |
|
| Back to top |
|
 |
GregW
Joined: 13 May 2008 Posts: 1
|
Posted: Fri Dec 19, 2008 1:34 pm Post subject: |
|
|
I am really sorry to be stupid.
I need to verify a particular IE page is fully loaded before I continue to login.
I downloaded and installed the std COM library into ...\Program Files\AutoHotKey\Lib and I downloaded the script at the top of this thread. When I run it I get that first error, "Internet Explorer_Server Not Found."
I looked through this whole thread but the comments seem to be on completely different topics than "Determine if a WebPage is completely loaded in IE".
I am sure I am missing something dumb.
TIA. |
|
| Back to top |
|
 |
tank
Joined: 21 Dec 2007 Posts: 3700 Location: Louisville KY USA
|
Posted: Fri Dec 19, 2008 5:36 pm Post subject: |
|
|
this script | Code: | ; Run, iexplore.exe http://www.google.com/
MsgBox, % IEReady()
Return
IEReady(hIESvr = 0)
{
If Not hIESvr
{
Loop, 50
{
ControlGet, hIESvr, hWnd, , Internet Explorer_Server1, A ; ahk_class IEFrame
If hIESvr
Break
Else Sleep 100
}
If Not hIESvr
Return """Internet Explorer_Server"" Not Found."
}
Else
{
WinGetClass, sClass, ahk_id %hIESvr%
If Not sClass == "Internet Explorer_Server"
Return "The specified control is not ""Internet Explorer_Server""."
}
COM_Init()
If DllCall("SendMessageTimeout", "Uint", hIESvr, "Uint", DllCall("RegisterWindowMessage", "str", "WM_HTML_GETOBJECT"), "Uint", 0, "Uint", 0, "Uint", 2, "Uint", 1000, "UintP", lResult)
&& DllCall("oleacc\ObjectFromLresult", "Uint", lResult, "Uint", COM_GUID4String(IID_IHTMLDocument2,"{332C4425-26CB-11D0-B483-00C04FD90119}"), "int", 0, "UintP", pdoc)=0
&& pdoc && pweb:=COM_QueryService(pdoc,IID_IWebBrowserApp:="{0002DF05-0000-0000-C000-000000000046}")
Loop
If COM_Invoke(pweb, "ReadyState") = 4
Break
Else Sleep 500
COM_Release(pdoc)
COM_Release(pweb)
COM_Term()
Return pweb ? "DONE!" : False
} | Brillantly written by Sean does require the page to be the active window as well as the page to be the active tab (For IE7)
However to use the topmost instance of IE but not necesarily an active instance change | Code: | | ControlGet, hIESvr, hWnd, , Internet Explorer_Server1, A ; ahk_class IEFrame | to | Code: | | ControlGet, hIESvr, hWnd, , Internet Explorer_Server1, ahk_class IEFrame |
a way to do this same thing without regard to active window would be like this ill use the page title instead here. The title need not remain the same but will at the initial call of the script need to match even if the page is not in an active tab (For IE7)
| Code: | MsgBox, % alt_IEReady("Google") ;; substitute any page title without the windows/internet explorer suffix
Return
alt_IEReady(pageSearched)
{
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,%pageSearched%
Break
COM_Release(pwb) ;didnt break so release the one we didnt use
}
loop
If (rdy:=COM_Invoke(pwb,"readyState") = 4)
break
COM_Release(psw), VarSetCapacity(psw, 0)
COM_Release(psh), VarSetCapacity(psh, 0)
COM_Release(pwb), VarSetCapacity(pwb, 0)
}
|
_________________
We are troubled on every side‚ yet not distressed; we are perplexed‚
but not in despair; Persecuted‚ but not forsaken; cast down‚ but not destroyed; |
|
| Back to top |
|
 |
Guest
|
Posted: Wed Feb 25, 2009 4:35 am Post subject: |
|
|
| Joy2DWorld wrote: | | Quote: | | The key here is to obtain the window handle of Internet Explorer_Server control |
ok, (silly question...)
how do we do that ?? [especially if control is inside another 'wrapper' like Maxathon, etc.]
and
Invoke() will then work as usual ??? |
How about for FireFox Application??
I tried Mozilla Firefox.Application, MozillaFirefox.Application, Firefox.Application and Firefox.exe but none of them works  |
|
| Back to top |
|
 |
garry
Joined: 19 Apr 2005 Posts: 2214 Location: switzerland
|
Posted: Wed Feb 25, 2009 7:02 am Post subject: |
|
|
examples work good for Internet explorer
Example for Firefox searches for picture
| Code: | ;-- FireFox : when is page loaded ------------------------------
;-- save first a small picture in FF with the word "Done" ----
;------ searches for the picture "FireFox_Done.bmp" ---------
#Persistent
Settitlematchmode,2
Coordmode,pixel
;PICTURE1=%A_scriptdir%\FireFox_Fertig.bmp
PICTURE1=%A_scriptdir%\FireFox_Done.bmp
UR=http://www.petri.co.il/download_free_reskit_tools.htm
IE=%A_programfiles%\Mozilla Firefox\firefox.exe
;-- opens URL max and then search down left corner %picture1% ---
;--- search aera must be bigger then the picture ----------------
WA=%A_screenwidth%
HA=%A_screenheight%
Y1 :=(HA*94)/100 ;
X2 :=(WA*12)/100 ;
Y2 :=(HA*98)/100 ;
MouseMove, WA, HA ,, R
Run,%IE% %UR%,,max
SetTimer,AAA,500
Return
;-----------------
AAA:
ImageSearch, FX,FY,0,Y1,X2,Y2, *20 %picture1% ;search in aera x1y1--x2y2
if ErrorLevel = 0 ; Image found
{
SetTimer,AAA,OFF
soundbeep,400,300
ExitApp
}
return
|
for mozilla FF this script searches for the running wheel right top, when wheel stopped is OK
control XY and color
| Code: |
;----------------------------------------------
#Persistent
Settitlematchmode,2
UR=http://www.t-online.de
SC=t-online
IE=%A_programfiles%\Mozilla Firefox\firefox.exe
Run,%IE% %UR%,,max
WinWait,%SC%
IfWinNotActive ,%SC%,,WinActivate,%SC%
WinWaitActive,%SC%
SetTimer,AAA,500
Return
;-----------------
AAA:
C1=0xB6B7B8
X1=1264
Y1=35
C2=0xB6B8B8
X2=1276
Y2=35
PixelGetColor, Var1, X1, Y1
PixelGetColor, Var2, X2, Y2
if (VAR1=C1 AND VAR2=C2) ;when wheel has stopped
{
soundbeep,400,300
Exitapp
}
return
|
Last edited by garry on Mon Mar 02, 2009 8:35 pm; edited 1 time in total |
|
| Back to top |
|
 |
Guest
|
Posted: Thu Feb 26, 2009 2:53 am Post subject: |
|
|
| garry wrote: | examples work good for Internet explorer
for mozilla FF this script searches for the running wheel right top, when wheel stopped is OK
control XY and colour
| Code: | ;-------- JAJAH-login FIREFOX3 -----------------
#Persistent
;-------- login passwords here ------------------
AA=garryxy1234@aolnet.com
BB=12345678
UR=http://www.jajah.com/login.aspx
SC=JAJAH
IE=%A_programfiles%\Mozilla Firefox\firefox.exe
CL=ahk_class MozillaWindowClass
WA=%A_screenwidth%
HA=%A_screenheight%
XN :=(WA*98.75)/100 ;1264
YN :=(HA*3.418)/100 ;35
col32:=0xB6B7B8
Run,%IE% %UR%,,max
WinWait,%SC%
IfWinNotActive ,%SC%,,WinActivate,%SC%
WinWaitActive,%SC%
Sleep,300
SetTimer,FireFoxLoadDetect,500
Return
;-----------------
FireFoxLoadDetect:
PixelGetColor, OutputVar, XN, YN
if outputvar=%col32%
{
sleep,1000
send,%AA%
sleep,500
send,{TAB}
sleep,500
send,%BB%
sleep,500
send,{ENTER}
sleep,500
ExitApp
}
return
|
|
The first half of the script works, however the second half do not.
It didn't type in the user name and password.
If I add "Run, calc.exe" below the script, it keeps opening calc.exe. I wonder why? I just want it to open 1 calc.exe :/ |
|
| Back to top |
|
 |
garry
Joined: 19 Apr 2005 Posts: 2214 Location: switzerland
|
Posted: Fri Feb 27, 2009 4:52 pm Post subject: |
|
|
it works for mozilla firefox, searches the running wheel right top, ok when wheel stops
but it's depending from
-version
-position
-colour
use windowspy to find position (XN YN) and colour (col32)
Edit: made other examples , a second one with imagesearch |
|
| Back to top |
|
 |
Astrognaw
Joined: 27 Mar 2009 Posts: 26
|
Posted: Fri Mar 27, 2009 1:50 am Post subject: |
|
|
I'm very very new to all of this! But I find it fun. =)
Can someone post an example of exactly what sean's first script does (the one that goes to google.com and then tells you when it's finished loading) and then immediately after you close the msgbox the same IE7 window navigates to autohotkey.com and then gives another msgbox?
I'll be so grateful! I think that would help me understand how this works better =) |
|
| Back to top |
|
 |
tank
Joined: 21 Dec 2007 Posts: 3700 Location: Louisville KY USA
|
Posted: Fri Mar 27, 2009 2:20 am Post subject: |
|
|
pretty good description why dont you experiment you would learn from that also _________________
We are troubled on every side‚ yet not distressed; we are perplexed‚
but not in despair; Persecuted‚ but not forsaken; cast down‚ but not destroyed; |
|
| Back to top |
|
 |
Astrognaw
Joined: 27 Mar 2009 Posts: 26
|
Posted: Fri Mar 27, 2009 2:33 am Post subject: |
|
|
| tank wrote: | | pretty good description why dont you experiment you would learn from that also |
I am!! Right now =)
I'll let you know how it goes!
Edit: NM! |
|
| 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
|