Jydlex Posted September 24, 2020 Share Posted September 24, 2020 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 More sharing options...
zeenmakr Posted September 25, 2020 Share Posted September 25, 2020 (edited) 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 September 25, 2020 by zeenmakr Link to comment Share on other sites More sharing options...
JockoDundee Posted September 25, 2020 Share Posted September 25, 2020 btw, instead of Local $iRandMS = Int(Random(660000, 960000)) you can also do Local $iRandMS = Random(660000, 960000, 1) Code hard, but don’t hard code... 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