Guest Sauron Posted May 10, 2005 Posted May 10, 2005 hi i want to create a macro for a homepage. but i have a problem with the polychronic times till the website loads complete (10, 20.. or many more seconds ). is it possibility to stop the macro automatically till the page loads complete? bye sauron (sorry 4 my english... i hope you can understand me )
quick_sliver007 Posted May 10, 2005 Posted May 10, 2005 hii want to create a macro for a homepage.but i have a problem with the polychronic times till the website loads complete (10, 20.. or many more seconds ).is it possibility to stop the macro automatically till the page loads complete?bye sauron(sorry 4 my english... i hope you can understand me )<{POST_SNAPBACK}>Most of the time I just work around things like this and use a Do Until Loop with a short sleep function only in the loop; and just do the loop until pixelgetcolor equals a color that only exists on the page after it has finished loading like this.Do Sleep(10) Until PixelGetColor(x,y) = (color)just fill in the x, y and color and this should work. Their is a tool (named: autoit window info) that comes with autoit that can get the values of the x, y and the color for you. .
MSLx Fanboy Posted May 11, 2005 Posted May 11, 2005 Not to be rude, but how often does a webpage take longer than 10 seconds to load? Most webmasters won't allow for more than 3-4 maybe 5...people are impatient when it comes to computers for some reason...considering the computer spends millions of clock cycles waiting on the user Writing AutoIt scripts since _DateAdd("d", -2, _NowCalcDate())
upnorth Posted May 11, 2005 Posted May 11, 2005 Are you using IE? Did you look at the com funcs? You will need the beta. CODE; AutoIt 3.1.1 beta version ; ; COM Test file ; ; Test usage of Events with Internet Explorer ; ; Create a simple GUI for our output #include "GUIConstants.au3" $GUIMain=GUICreate ( "Event Test", 640, 480 ) $GUIEdit=GUICtrlCreateEdit ( "Test Log:" & @CRLF, 10, 10 , 600 , 400 ) GUISetState () ;Show GUI $oMyError=ObjEvent("AutoIt.Error","MyErrFunc") $oIE=ObjCreate("InternetExplorer.Application.1") if @error then Msgbox(0,"","Error opening Internet Explorer: " & @error) exit endif $oIE.Visible=1 $oIE.RegisterAsDropTarget = 1 $oIE.RegisterAsBrowser = 1 ; The Event interfaces of the Internet Explorer are defined in: SHDOCVW.DLL ; ; HTMLElementEvents2 ; DWebBrowserEvents ; DWebBrowserEvents2 ; -> NOTE1: If you have installed VC6 (DevStudio8) this one is renamed to: DWebBrowserEvent2Sink ! ; -> NOTE2: If you have installed the Adobe Acrobat Reader 6.0 IE plugin then the type library of this ; interface is modified to "AcroIEHelper 1.0 Type Library" $SinkObject=ObjEvent($oIE,"IEEvent_","DWebBrowserEvents") if @error then Msgbox(0,"AutoIt COM Test","ObjEvent: Can't use interface 'DWebBrowserEvents2'. error code: " & hex(@error,8)) exit endif ProgressOn ( "Internet Explorer Event test", "Loading web page","",-1,-1, 16 ) $URL = "http://www.AutoItScript.com/" $oIE.Navigate( $URL ) sleep(4000) ; Give it the time to load the web page $SinkObject=0 ; Stop IE Events $oIE.Quit ; Quit IE $oIE=0 ProgressOff() GUISwitch ( $GUIMain ) ; In case IE stealed the focus GUICtrlSetData ( $GUIEdit, @CRLF & "End of Internet Explorer Events test." & @CRLF , "append" ) GUICtrlSetData ( $GUIEdit, "You may close this window now !" & @CRLF , "append" ) ; Waiting for user to close the window While 1 $msg = GUIGetMsg() If $msg = $GUI_EVENT_CLOSE Then ExitLoop Wend GUIDelete () exit ; a few Internet Explorer Event Functions ; --------------------------------------- Func IEEvent_ProgressChange($Progress,$ProgressMax) ProgressSet ( ($Progress * 100) / $ProgressMax , ($Progress * 100) / $ProgressMax & " percent to go." , "loading web page" ) EndFunc Func IEEvent_StatusTextChange($Text) GUICtrlSetData ( $GUIEdit, "IE Status text changed to: " & $Text & @CRLF , "append" ) EndFunc Func IEEvent_PropertyChange( $szProperty) GUICtrlSetData ( $GUIEdit, "IE Changed the value of the property: " & $szProperty & @CRLF , "append" ) EndFunc Func IEEvent_DownloadBegin() GUICtrlSetData ( $GUIEdit, "IE has started a navigation operation" & @CRLF , "append" ) EndFunc Func IEEvent_DownloadComplete() GUICtrlSetData ( $GUIEdit, "IE has finished a navigation operation" & @CRLF , "append" ) EndFunc Func IEEvent_NavigateComplete2($oWebBrowser,$URL) ; IDispatch *pDisp, ; VARIANT *URL GUICtrlSetData ( $GUIEdit, "IE has finished loading URL: " & $URL & @CRLF , "append" ) EndFunc ; AutoIt Error Event Function ; --------------------------- Func MyErrFunc() $HexNumber=hex($oMyError.number,8) Msgbox(0,"","We intercepted a COM Error !" & @CRLF & @CRLF & _ "err.description is: " & @TAB & $oMyError.description & @CRLF & _ "err.windescription:" & @TAB & $oMyError.windescription & @CRLF & _ "err.number is: " & @TAB & $HexNumber & @CRLF & _ "err.lastdllerror is: " & @TAB & $oMyError.lastdllerror & @CRLF & _ "err.scriptline is: " & @TAB & $oMyError.scriptline & @CRLF & _ "err.source is: " & @TAB & $oMyError.source & @CRLF & _ "err.helpfile is: " & @TAB & $oMyError.helpfile & @CRLF & _ "err.helpcontext is: " & @TAB & $oMyError.helpcontext _ ) SetError(1) ; to check for after this function returns Endfunc
buzz44 Posted May 11, 2005 Posted May 11, 2005 (edited) BTW, The Sleep() Function is measured in milliseconds so Sleep(10) is 10 milliseconds (1/100th of a second), not 10 seconds.... which would be Sleep(10000). Edited May 11, 2005 by Burrup qq
Guest Sauron Posted May 11, 2005 Posted May 11, 2005 thanks the method with x,y and pixel color works good.
quick_sliver007 Posted May 11, 2005 Posted May 11, 2005 thanks the method with x,y and pixel color works good.<{POST_SNAPBACK}>You welcome .
Stormy Posted May 15, 2005 Posted May 15, 2005 hello, work the same with words? e.g.: Welcome on my Page! and when a page has loading problems, can i include a refresh after 30 sec's?
MSLx Fanboy Posted May 15, 2005 Posted May 15, 2005 $title = WinGetTitle("the window title") ControlSend($title, "", "", "^{F5}") That should pull the full window title of the window title you entered, and then send a Ctrl+F5 to it (a forced page-refresh). Writing AutoIt scripts since _DateAdd("d", -2, _NowCalcDate())
fmen Posted May 15, 2005 Posted May 15, 2005 (edited) Do Sleep(10) Until PixelGetColor(x,y) = (color) ============================================== Genius stuff! Thank you. I have been trying to find a better solution for a long time.. Edited May 15, 2005 by fmen
JSThePatriot Posted May 15, 2005 Posted May 15, 2005 One thing I always did instead of the PixelGetColor() was the StatusBarGetText() because if this script ever needs to go on another computer the browser will have to be the same size and in the same position and with the same resolution for it to work. JS AutoIt Links File-String Hash Plugin Updated! 04-02-2008 Plugins have been discontinued. I just found out. ComputerGetInfo UDF's Updated! 11-23-2006 External Links Vortex Revolutions Engineer / Inventor (Web, Desktop, and Mobile Applications, Hardware Gizmos, Consulting, and more)
Stormy Posted May 16, 2005 Posted May 16, 2005 ok... StatusbarGetText("Internet Explorer") works. THX! but i don't know how can i integrate this into a loop? i want continue the loop till the web-site loads complete. i tried this: Do Sleep(10) Until StatusbarGetText("Internet Explorer") = (Fertig) it doesn´t work can someone give me an example please?
steveR Posted May 16, 2005 Posted May 16, 2005 Do Sleep(10) Until StatusbarGetText("Internet Explorer") = "Fertig" strings go between quotes AutoIt3 online docs Use it... Know it... Live it...MSDN libraryglobal Help and SupportWindows: Just another pane in the glass.
Stormy Posted May 16, 2005 Posted May 16, 2005 DoSleep(10)Until StatusbarGetText("Internet Explorer") = "Fertig"i tried this... but when the page loads complete (Fertig) the script do nothing
JSThePatriot Posted May 16, 2005 Posted May 16, 2005 i tried this... but when the page loads complete (Fertig) the script do nothing <{POST_SNAPBACK}>Is the (Fertig) in the () on the status bar? If so should be as follows...Do Sleep(10) Until StatusBarGetText("Internet Explorer") = "(Fertig)"I dont think that is the case... That being the issue.. do the following.Let the webpage load and do this.MsgBox(0, "Debug", StatusBarGetText("Internet Explorer"))I hope this helps some,JS AutoIt Links File-String Hash Plugin Updated! 04-02-2008 Plugins have been discontinued. I just found out. ComputerGetInfo UDF's Updated! 11-23-2006 External Links Vortex Revolutions Engineer / Inventor (Web, Desktop, and Mobile Applications, Hardware Gizmos, Consulting, and more)
Stormy Posted May 16, 2005 Posted May 16, 2005 Fertig is without the () i tried this:MsgBox(0, "Debug", StatusBarGetText("Internet Explorer"))but i get only a blank MsgBox
steveR Posted May 16, 2005 Posted May 16, 2005 (edited) Put this at the top of the script to see if it changes anything (under the #include statement)Opt("WinTitleMatchMode", 2)I assume (fertig) is at the far left of the statusbar, panel 1? If it's not, you have to supply the panel number:StatusbarGetText ( "title" [, "text" [, part]] ) Parameters title The title of the window to check. text [optional] The text of the window to check. part [optional] The "part" number of the status bar to read - the default is 1. 1 is the first possible part and usually the one that contains the useful messages like "Ready" "Loading...", etc. I was able to get this to work on mine. Mine says "Done":opt("WinTitleMatchMode", 2) $title = "Internet Explorer" WinWaitActive($title) Do Sleep(50) Until StatusbarGetText($title) = "Done" MsgBox(0, "", StatusbarGetText($title)) Edited May 16, 2005 by steveR AutoIt3 online docs Use it... Know it... Live it...MSDN libraryglobal Help and SupportWindows: Just another pane in the glass.
Stormy Posted May 16, 2005 Posted May 16, 2005 thx! thx! thx! i found my mistake...the window title of my browser ist "Microsoft Internet Explorer" thank you & bye
fmen Posted May 17, 2005 Posted May 17, 2005 StatusbarGetText seems to work with Internet Explorer but not Firefox. Has anyone had any success with Firefox? Am I doing something wrong
JSThePatriot Posted May 17, 2005 Posted May 17, 2005 StatusbarGetText seems to work with Internet Explorer but not Firefox. Has anyone had any success with Firefox? Am I doing something wrong<{POST_SNAPBACK}>Using AutoIt Info it shows that AutoIt doesnt pickup the status bar text of Firefox. There may be another way, but there isnt using that function as of right now.JS AutoIt Links File-String Hash Plugin Updated! 04-02-2008 Plugins have been discontinued. I just found out. ComputerGetInfo UDF's Updated! 11-23-2006 External Links Vortex Revolutions Engineer / Inventor (Web, Desktop, and Mobile Applications, Hardware Gizmos, Consulting, and more)
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now