Jump to content
Sign in to follow this  
Andy2k14

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

 

Share this post


Link to post
Share on other sites

Your code is very strange...

 - the loop seems unnecessary

 - wait() si undefined

 
The only warning we have here is an error saying "wait (1000) is an unknown function".
 

Share this post


Link to post
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.

Share this post


Link to post
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

Share this post


Link to post
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
Sign in to follow this  

×
×
  • Create New...