Jump to content

For Loop Issue


Recommended Posts

Can anyone spot why my code is broken. It complains it is missing a Next statement.

;Poll pixel colour until SPTAC is set or 12 seconds has elapsed
For $i = 1 To 12 Step +1
   local $Status_Colour = PixelGetColor(24, 207)
   If $Status_Colour = 15790320 Then
      ExitLoop
   ElseIf $Status_Colour = 0 then
      MsgBox($MB_SYSTEMMODAL, "", "Please restart the application")
      Exit
   EndIf
   wait(1000)
Next

Thanks

 

Link to comment
Share on other sites

i need the loop to check for a colour change on a certain pixel. I am allowing 12 seconds for this to happen. If the pixel colour does not change within 12 seconds i want to script to exit. If the colour changes within 12 seconds the script is to continue as normal.

I could just sleep for 12 seconds then do a pixel check but in my application the colour change can happen anywhere betyween 1 and 12 seconds. I save cycle time this way.

Link to comment
Share on other sites

  • Moderators

Same here as jguinch, please show your wait() function, or (better) the entire code, so we can see what you're trying to do.

"Profanity is the last vestige of the feeble mind. For the man who cannot express himself forcibly through intellect must do so through shock and awe" - Spencer W. Kimball

How to get your question answered on this forum!

Link to comment
Share on other sites

Can anyone spot why my code is broken. It complains it is missing a Next statement.

;Poll pixel colour until SPTAC is set or 12 seconds has elapsed
For $i = 1 To 12 Step +1
   local $Status_Colour = PixelGetColor(24, 207)
   If $Status_Colour = 15790320 Then
      ExitLoop
   ElseIf $Status_Colour = 0 then
      MsgBox($MB_SYSTEMMODAL, "", "Please restart the application")
      Exit
   EndIf
   wait(1000)
Next

Thanks

;Poll pixel colour until SPTAC is set or 12 seconds has elapsed
For $i = 1 To 12 Step +1
   local $Status_Colour = PixelGetColor(24, 207)
   If $Status_Colour = 15790320 Then
      ExitLoop
   ElseIf $Status_Colour = 0 then
      MsgBox($MB_SYSTEMMODAL, "", "Please restart the application")
      Exit
   EndIf
   Sleep(1000)
Next

this

EDIT: keep in mind, this is bit more than 12 seconds

>Exit code: 0    Time: 12.41
Edited by JustSomeone
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...