joker17 Posted October 26, 2007 Share Posted October 26, 2007 if ($resW==1024) Then $coord = PixelSearch (400, 15, 568, 30, 0xFE2734) ElseIf ($resW==1280) Then $coord = PixelSearch (500, 20, 710, 40, 0xFE2734) endif if @error Then send("ciao") Else send ("byebye") endif Ok autoit recognize the pixel and teh variable correctly and if there is the error it correctly send "ciao" but if there is no error it does'nt send byebye why? Link to comment Share on other sites More sharing options...
PsaltyDS Posted October 26, 2007 Share Posted October 26, 2007 (edited) if ($resW==1024) Then $coord = PixelSearch (400, 15, 568, 30, 0xFE2734) ElseIf ($resW==1280) Then $coord = PixelSearch (500, 20, 710, 40, 0xFE2734) endif if @error Then send("ciao") Else send ("byebye") endif Ok autoit recognize the pixel and teh variable correctly and if there is the error it correctly send "ciao" but if there is no error it does'nt send byebye why? What is it sending it to? Send() just sends to the currently active Window/Control. If the condition that generates the @error also means the desired Window/Control are not active, then "byebye" is being sent somewhere else (where it may just be ignored). P.S. Use ControlSend() instead to ensure it goes to the intended Window/Control. Edited October 26, 2007 by PsaltyDS Valuater's AutoIt 1-2-3, Class... Is now in Session!For those who want somebody to write the script for them: RentACoder"Any technology distinguishable from magic is insufficiently advanced." -- Geek's corollary to Clarke's law Link to comment Share on other sites More sharing options...
joker17 Posted October 26, 2007 Author Share Posted October 26, 2007 the send is just a sample, instead of putting in the original code (that i've tested and works 100%) that is too long Link to comment Share on other sites More sharing options...
Nevin Posted October 26, 2007 Share Posted October 26, 2007 When it doesn't send byebye, does it send ciao instead, or just nothing at all? Link to comment Share on other sites More sharing options...
joker17 Posted October 26, 2007 Author Share Posted October 26, 2007 When it doesn't send byebye, does it send ciao instead, or just nothing at all?nothing at all Link to comment Share on other sites More sharing options...
Nevin Posted October 26, 2007 Share Posted October 26, 2007 I don't see why not. I just did this as a test. Pixelsearch(50,50,60,60,0xFFFFFF,0,1) if @error Then msgbox(0,"failed",@error) Else msgbox(0,"success",@error) endif It worked properly, I tried it with both a success and failure. Link to comment Share on other sites More sharing options...
joker17 Posted October 26, 2007 Author Share Posted October 26, 2007 I don't see why not. I just did this as a test. Pixelsearch(50,50,60,60,0xFFFFFF,0,1) if @error Then msgbox(0,"failed",@error) Else msgbox(0,"success",@error) endif It worked properly, I tried it with both a success and failure.yes man it works even for me if i dont put the 2 pixelsearch into another if sentence Link to comment Share on other sites More sharing options...
Zedna Posted October 26, 2007 Share Posted October 26, 2007 Try this: If ($resW == 1024) Then $l = 400 $t = 15 $r = 568 $b = 30 ElseIf ($resW == 1280) Then $l = 500 $t = 20 $r = 710 $b = 40 EndIf $coord = PixelSearch($l, $t, $r, $b, 0xFE2734) If @error Then Send("ciao") Else Send("byebye") EndIf Resources UDF Â ResourcesEx UDF Â AutoIt Forum Search Link to comment Share on other sites More sharing options...
PsaltyDS Posted October 26, 2007 Share Posted October 26, 2007 the send is just a sample, instead of putting in the original code (that i've tested and works 100%) that is too longThat's the problem with bogus code, it leads to bogus answers. If you want a real answer post the real code. Valuater's AutoIt 1-2-3, Class... Is now in Session!For those who want somebody to write the script for them: RentACoder"Any technology distinguishable from magic is insufficiently advanced." -- Geek's corollary to Clarke's law Link to comment Share on other sites More sharing options...
joker17 Posted October 26, 2007 Author Share Posted October 26, 2007 Try this: If ($resW == 1024) Then $l = 400 $t = 15 $r = 568 $b = 30 ElseIf ($resW == 1280) Then $l = 500 $t = 20 $r = 710 $b = 40 EndIf $coord = PixelSearch($l, $t, $r, $b, 0xFE2734) If @error Then Send("ciao") Else Send("byebye") EndIfman i'll try this when i come back (i'm going to motorschool, sry bad english) but i think it will work ^^ Link to comment Share on other sites More sharing options...
Nevin Posted October 26, 2007 Share Posted October 26, 2007 Good luck. Kind of pointless for me to say, but I tried it with an if statement and it worked as well.. $blah=0;Tried as both zero and one successfully if ($blah=1) Then $coord = PixelSearch (50,50,60,60,0xFFFFFF) ElseIf ($blah=0) Then $coord = PixelSearch (50,50,60,60,0xFFFFFF) endif if @error Then msgbox(0,"failed",@error) Else msgbox(0,"success",@error) endif Link to comment Share on other sites More sharing options...
PsaltyDS Posted October 26, 2007 Share Posted October 26, 2007 yes man it works even for me if i dont put the 2 pixelsearch into another if sentence The If/Else/EndIf clauses have nothing to do with it. This works fine: For $n = 1 To 20 If Random(0, 1, 1) Then PixelSearch(50, 50, 60, 60, 0xF, 0, 1) Else PixelSearch(50, 50, 60, 60, 0xFFFFFF, 0, 1) EndIf If @error Then ConsoleWrite("failed: " & @error & @LF) Else ConsoleWrite("success" & @LF) EndIf Next Valuater's AutoIt 1-2-3, Class... Is now in Session!For those who want somebody to write the script for them: RentACoder"Any technology distinguishable from magic is insufficiently advanced." -- Geek's corollary to Clarke's law Link to comment Share on other sites More sharing options...
Blue_Drache Posted October 26, 2007 Share Posted October 26, 2007 (edited) There's nothing wrong with @error... Remember, 99% of ALL errors is a problem with the wetware (specifically: Syntax Errors), not the software. You're probably using a function that doesn't set @error. There are functions that do that, such as WinWaitActive(). WinWaitActive returns 1 or 0, and doesn't set @error, but it WILL reset @error to zero. Remember, @error is reset by ANY funciton. User Defined or otherwise. If you need to save the state of @error store it into a variable immediately after exiting the particular funciton you're testing. Edited October 26, 2007 by Blue_Drache Lofting the cyberwinds on teknoleather wings, I am...The Blue Drache 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