AutoHotkey Community

It is currently May 26th, 2012, 4:31 pm

All times are UTC [ DST ]




Post new topic Reply to topic  [ 119 posts ]  Go to page Previous  1 ... 3, 4, 5, 6, 7, 8  Next
Author Message
 Post subject:
PostPosted: April 5th, 2008, 8:30 am 
Thanks Lexikos :)


Report this post
Top
  
Reply with quote  
PostPosted: July 5th, 2008, 11:31 am 
Offline

Joined: July 5th, 2008, 11:15 am
Posts: 6
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?


Report this post
Top
 Profile  
Reply with quote  
PostPosted: July 5th, 2008, 3:43 pm 
Offline

Joined: February 12th, 2007, 7:54 am
Posts: 2462
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.


Report this post
Top
 Profile  
Reply with quote  
 Post subject:
PostPosted: August 24th, 2008, 6:56 pm 
Offline
User avatar

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

_________________
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: December 18th, 2008, 5:54 pm 
Offline

Joined: December 18th, 2008, 9:25 am
Posts: 6
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...: (


Report this post
Top
 Profile  
Reply with quote  
 Post subject:
PostPosted: December 18th, 2008, 7:46 pm 
Offline
User avatar

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

_________________
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: December 19th, 2008, 2:34 pm 
Offline

Joined: May 13th, 2008, 2:00 am
Posts: 1
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.


Report this post
Top
 Profile  
Reply with quote  
 Post subject:
PostPosted: December 19th, 2008, 6:36 pm 
Offline
User avatar

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

_________________
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: February 25th, 2009, 5:35 am 
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 :(


Report this post
Top
  
Reply with quote  
 Post subject:
PostPosted: February 25th, 2009, 8:02 am 
Offline

Joined: April 19th, 2005, 10:26 am
Posts: 2249
Location: switzerland
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 March 2nd, 2009, 9:35 pm, edited 1 time in total.

Report this post
Top
 Profile  
Reply with quote  
 Post subject:
PostPosted: February 26th, 2009, 3:53 am 
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 :/


Report this post
Top
  
Reply with quote  
 Post subject:
PostPosted: February 27th, 2009, 5:52 pm 
Offline

Joined: April 19th, 2005, 10:26 am
Posts: 2249
Location: switzerland
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


Report this post
Top
 Profile  
Reply with quote  
 Post subject:
PostPosted: March 27th, 2009, 2:50 am 
Offline

Joined: March 27th, 2009, 1:00 am
Posts: 26
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 =)


Report this post
Top
 Profile  
Reply with quote  
 Post subject:
PostPosted: March 27th, 2009, 3:20 am 
Offline
User avatar

Joined: December 21st, 2007, 3:14 pm
Posts: 3826
Location: Louisville KY USA
pretty good description why dont you experiment you would learn from that also

_________________
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: March 27th, 2009, 3:33 am 
Offline

Joined: March 27th, 2009, 1:00 am
Posts: 26
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!


Report this post
Top
 Profile  
Reply with quote  
Display posts from previous:  Sort by  
Post new topic Reply to topic  [ 119 posts ]  Go to page Previous  1 ... 3, 4, 5, 6, 7, 8  Next

All times are UTC [ DST ]


Who is online

Users browsing this forum: Google Feedfetcher, maul.esel and 17 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