Sign in to follow this  
Followers 0
Andy2k14

For Loop Issue

8 posts in this topic

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



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

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


When you're dead, you don't know you're dead - it's only difficult for those that know you. It's the same way when you're stupid...

My Scripts: SCCM UDFInclude Source with Compiled Script, Windows Firewall UDF

Share this post


Link to post
Share on other sites

What JLogan said ... This loop is fine ... We need to see more code to diagnose the problem.  Post all of it and we'll be able to help you.


Lofting the cyberwinds on teknoleather wings, I am...The Blue Drache

Share this post


Link to post
Share on other sites

#8 ·  Posted (edited)

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  
Followers 0