Jump to content

Supress error messages


 Share

Recommended Posts

basically I am mucking about with the pixel search method and have written the following:

$coord = PixelSearch ( $left, $top, $right, $bottom, 0x000000))
If Not @error Then
    MsgBox(0, "X and Y are:", $coord[0] & "," & $coord[1])
Else
    Sleep(1000)
            Send ("{ENTER}")
    EndIf

the problem is if an error does occur it does not seem to pressing 'enter'; so is there anyway to supress it or something?

thanks.

and a second question ill tag on is how can you see if a page is laoded without winwait ive tried the code below and but it does not seem to loop; ideally i want it to send a site; run it through here to see if its loaded and then carry on.

;$loaded = 15460567
;$loading1 = 11074943
;$loading2 = 16382457
;$var = PixelGetColor( 945 , 725 );checks the loading bar
;$load=0
;Func _PageLoadcheck()
;If WinActive("404 Not Found - Mozilla Firefox","") Then
;Send("{F5}")
;Sleep(Random($SiteWait, $MaxSiteWait, 1))
;ElseIf WinWaitActive("Page Load Error - Mozilla Firefox","") Then
;Send("{F5}")
;Sleep(Random($MinSiteWait, $MaxSiteWait, 1))
;ElseIf $var = $loaded Then
;$load=1
;;EndIf
;EndFunc
Link to comment
Share on other sites

basically I am mucking about with the pixel search method and have written the following:

$coord = PixelSearch ( $left, $top, $right, $bottom, 0x000000))
If Not @error Then
    MsgBox(0, "X and Y are:", $coord[0] & "," & $coord[1])
Else
    Sleep(1000)
            Send ("{ENTER}")
    EndIf

the problem is if an error does occur it does not seem to pressing 'enter'; so is there anyway to supress it or something?

thanks.

Suppress what?

You do not have to act on the @error flag. Or do you get a Terminal error message from the script engine?

and a second question ill tag on is how can you see if a page is laoded without winwait ive tried the code below and but it does not seem to loop; ideally i want it to send a site; run it through here to see if its loaded and then carry on.

;$loaded = 15460567
;$loading1 = 11074943
;$loading2 = 16382457
;$var = PixelGetColor( 945 , 725 );checks the loading bar
;$load=0
;Func _PageLoadcheck()
;If WinActive("404 Not Found - Mozilla Firefox","") Then
;Send("{F5}")
;Sleep(Random($SiteWait, $MaxSiteWait, 1))
;ElseIf WinWaitActive("Page Load Error - Mozilla Firefox","") Then
;Send("{F5}")
;Sleep(Random($MinSiteWait, $MaxSiteWait, 1))
;ElseIf $var = $loaded Then
;$load=1
;;EndIf
;EndFunc
;) Is this code supposed to have a loop in it? When you use WinWaitActive the window has to be the active one before the code will continue. Is that the issue?

It is possible you would be better off by using the I explore automation library <IE.au3>, if firefox ain't a strict requirement. Samples in the help file.

Link to comment
Share on other sites

woops double post;

yes i get a terminal error message if it can not find the colour specified;

regarding second point; Firefox is a requirement; mainly now because I have based alot of the functions around it; and i can not use winwait function because the pages are dynamic and therefore the pages names are also dynamic; so unless there is a way to find out the title I cannot think of another way.

re: winwait for 404 / page not found; i only want them to come into play if that page title appears

Edited by Donace
Link to comment
Share on other sites

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 account

Sign in

Already have an account? Sign in here.

Sign In Now
 Share

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...