Jump to content

Timer start when window opens


Jydlex
 Share

Recommended Posts

I need this ;

"set one variable"

"variable" = random number between 660000-960000 (in ms)

when xxxx window opened start timer in ms

if timer equal "variable" 

   start action(i can edit here)

 Please help me how can i do this. Thanks for everyone.

Link to comment
Share on other sites

i honest dont' know what you want to do

Global Const $_CLASS_TITLE_XXX = '[CLASS:???; TITLE:XXX]'
Global $iDone = False

; "set one variable"
; "variable" = random number between 660000-960000 (in ms)
Local $iRandMS = Int(Random(660000, 960000))


While 1
  ; when xxxx window opened start timer in ms
  If WinActive($_CLASS_TITLE_XXX) Then

      ; if timer equal "variable"
      Local $iTimer = 0 ;'What would you want timer to be? do you want count down from $iRandMS?'
      Local $iCountDown = Int($iRandMS/1000)
      While  1
          $iCountDown -= 1
          If $iCountDown <= iTimer Then 
              ; start action(i can edit here)
              MsgBox(0, @ScriptLineNumber&': TimeUp', 'Ready or Not!')
              $iDone = True
              ExitLoop
          EndIf
          Sleep(1000)
      WEnd
  EndIf
  If $iDone Then ExitLoop
  Sleep(100)
WEnd

MsgBox(0, @ScriptLineNumber&': Exit', 'Done')

 

Edited by zeenmakr
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...