Matrix112 Posted September 27, 2005 Share Posted September 27, 2005 (edited) Hi, this UDF pauses the script until Firefox finished loading. Use the window info tool to get coordinates of the left side of the loading bar. This is my first UDF I think that can be useful. FfLoad.au3 expandcollapse popup;====================================================================================== ; ; Function Name: _FfLoadWait() ; Description: Pauses the script until Firefox finished loading. ; Parameter(s): $x - The X coordinate of the Blue loading bar. ; $y - The Y coordinate of the Blue loading bar. ; $pcm - PixelCoordMode ; 0 = relative coords to the active window ; 1 = absolute screen coordinates (default) ; 2 = relative coords to the client area of the active window ; $lbc - Dec clour of the loading bar (optional) Default is standard ; bar colour. ; Requirement(s): Include FfLoad.au3 ; Return Value(s): Nothing. ; Author(s): Christoph Krogmann <ch.krogmann@gmx.de> ; Note(s): During search for the coordinate, choose a point at the left ; side of the loading bar! ; ;====================================================================================== ; Func _FfLoadWait ($x, $y, $pcm, $lbc = 664682) Opt("PixelCoordMode", $pcm) Local $i Local $iColor Do $iColor = PixelGetColor($x ,$y) If $iColor = $lbc Then $i = 1 Else Endif Sleep(20) Until $i = 1 Do $iColor = PixelGetColor($x ,$y) If $iColor = $lbc Then Else $i = 2 Endif Sleep(20) Until $i = 2 EndFunc;==>_FfLoadWait Example: #include <FfLoad.au3> $path = "start your URL" Run(@ComSpec & " /c " & $path, "", @SW_HIDE) Opt("WinTitleMatchMode", 2) WinWait("Mozilla Firefox") WinSetState("Mozilla Firefox", "", @SW_MAXIMIZE) _FfLoadWait(820, 732, 1);<<-- Put in your coordinates here MsgBox(0, "Finished", "Load is finished") Exit Edit: Added PixelCoordMode Edit: Update You can now set the colour of loading bar. FfLoad.au3 Example.au3 Edited October 1, 2005 by Matrix112 Link to comment Share on other sites More sharing options...
w0uter Posted September 28, 2005 Share Posted September 28, 2005 i use a custom skin + extentions My UDF's:;mem stuff_Mem;ftp stuff_FTP ( OLD );inet stuff_INetGetSource ( OLD )_INetGetImage _INetBrowse ( Collection )_EncodeUrl_NetStat_Google;random stuff_iPixelSearch_DiceRoll Link to comment Share on other sites More sharing options...
Matrix112 Posted September 29, 2005 Author Share Posted September 29, 2005 I have modified my UDF a little. This UDF waits Max. 30 sec for finish loading and will return 1 if it hasn´t finished. I won´t update my UDf with this because its only for 30 sec. Just see it as another option if you need to check if it can´t load complete in 30 sec. FfLoad2.au3 expandcollapse popup;====================================================================================== ; ; Function Name: _FfLoadWaitTime() ; Description: Pauses the script until Firefox finished loading. Max. 30 sec. ; Parameter(s): $x - The X coordinate of the Blue loading bar. ; $y - The Y coordinate of the Blue loading bar. ; $c - PixelCoordMode ; 0 = relative coords to the active window ; 1 = absolute screen coordinates (default) ; 2 = relative coords to the client area of the active window ; Requirement(s): Include FfLoad.au3 ; Return Value(s): If loading is not finished in 30 sec the Return is 1 else Return is 0. ; Author(s): Christoph Krogmann <ch.krogmann@gmx.de> ; Note(s): During search for the coordinate, choose a point at the left ; side of the loading bar! ; ;====================================================================================== ; Func _FfLoadWaitTime ($x, $y, $c) Opt("PixelCoordMode", $c) Local $i Local $iColor Local $isec = @SEC Local $istop If $isec < 30 Then $istop = $isec + 30 If $isec = 30 Then $istop = $isec - 29 If $isec > 30 Then $istop = $isec - 30 Do $iColor = PixelGetColor($x ,$y) If $iColor = 664682 Then $i = 1 Else Endif Sleep(20) Until $i = 1 Do $isec = @SEC $iColor = PixelGetColor($x ,$y) If $iColor = 664682 Then If $isec = $istop Then $i = 2 Return 1 EndIf Else $i = 2 Return 0 Endif Sleep(20) Until $i = 2 EndFunc;==>_FfLoadWaitTime Example2.au3 #include <FfLoad2.au3> $path = "start your URL" Run(@ComSpec & " /c " & $path, "", @SW_HIDE) Opt("WinTitleMatchMode", 2) WinWait("Mozilla Firefox") WinSetState("Mozilla Firefox", "", @SW_MAXIMIZE) $load = _FfLoadWaitTime(820, 732, 1);<<-- Put in your coordinates here If $Load = 1 Then MsgBox(0, "Failed", "Load failed") Else MsgBox(0, "Finished", "Load is finished") EndIf Exit FfLoad2.au3 Example2.au3 Link to comment Share on other sites More sharing options...
kclteam Posted April 1, 2006 Share Posted April 1, 2006 nice one Matrix....needed one real badly...thank u I believe we should all pay our tax with a smile. I tried - but they wanted cash! Link to comment Share on other sites More sharing options...
Gif Posted May 19, 2007 Share Posted May 19, 2007 nice one Matrix....needed one real badly...thank uok out of the subjectOPERA rocks!!! then comes FF and flock and netscape , finally IE which i personally HATEbut better use this Link to comment Share on other sites More sharing options...
xStylezx Posted May 20, 2007 Share Posted May 20, 2007 (edited) Nice to see Firefox scripts.Hope to see more Edited May 20, 2007 by xStylezx Link to comment Share on other sites More sharing options...
Insolence Posted May 20, 2007 Share Posted May 20, 2007 (edited) I did a little research and I found out Firefox has a COM-like interface(right word?) you can mess with. Using that, like the IE libraries on here, you can tell (for sure, any skin) if Firefox is loaded.Also, you should use SetError(), or return negative numbers for exceptions (IMO).EDIT: Someone already did it for ya http://www.autoitscript.com/forum/index.php?showtopic=20450 Edited May 20, 2007 by Insolence "I thoroughly disapprove of duels. If a man should challenge me, I would take him kindly and forgivingly by the hand and lead him to a quiet place and kill him." - Mark TwainPatient: "It hurts when I do $var_"Doctor: "Don't do $var_" - Lar. Link to comment Share on other sites More sharing options...
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