Blindz Posted May 28, 2009 Posted May 28, 2009 Hi, I'm new at Autoit! and im now working on a little project for me and my friend! but im stuck I need something that after 1min the script gonna call my function "TesT" for exemple : While 1 Send("+") MouseClick("right") After 1 min it calls my Function "Test" Wend Someone can help me please ? Thanks
herewasplato Posted May 28, 2009 Posted May 28, 2009 Welcome to the forum. Look in the help file under Sleep or TimerInit [size="1"][font="Arial"].[u].[/u][/font][/size]
Blindz Posted May 28, 2009 Author Posted May 28, 2009 herewasplato said: Welcome to the forum.Look in the help file under Sleep or TimerInithmm not sure how to use it!! i dont know how to calls my function after 1 min
stampy Posted May 28, 2009 Posted May 28, 2009 sleep(60000) ;<<<sleep one minute test() ;<<<run the test function
Blindz Posted May 28, 2009 Author Posted May 28, 2009 (edited) stampy said: sleep(60000) ;<<<sleep one minute test() ;<<<run the test function hmm!! that's not exactly what im looking for.. what i need is that the program look every seconds if its running for 1min, if yes then it call my function! Edited May 28, 2009 by Blindz
stampy Posted May 28, 2009 Posted May 28, 2009 I'm a little confused. How is checking every second to see if it's run for one minute different than just waiting for one minute? If that is really what you need then you can set a timer with timerinit() and check it every second with timerdiff().
nuki Posted May 28, 2009 Posted May 28, 2009 (edited) While 1 Send("+") MouseClick("right") $timer += 50 Sleep(50) If $timer >= 60000 Then Test() EndIf Wend or $bTimer = True While 1 Send("+") MouseClick("right") If $bTimer = True Then $vTimer = TimerInit() $bTimer = False EndIf If TimerDiff($vTimer) >= 60000 Then Test() $bTimer = True EndIf Wend or AdlibEnable ( "test" , 60000 ) While 1 Send("+") MouseClick("right") After 1 min it calls my Function "Test" Wend Func test() ;blablabla AdlibDisable() EndFunc Edited May 28, 2009 by nuki
Blindz Posted May 28, 2009 Author Posted May 28, 2009 (edited) stampy said: I'm a little confused. How is checking every second to see if it's run for one minute different than just waiting for one minute?If that is really what you need then you can set a timer with timerinit() and check it every second with timerdiff().ok looks like its Timerdiff that i need, now what i need is : If the timerdiff reach 1300 then Msgbox!!Thanks for all your help Edited May 28, 2009 by Blindz
nuki Posted May 28, 2009 Posted May 28, 2009 Blindz said: ok looks like its Timerdiff that i need, now what i need is : If the timerdiff reach 1300 then Msgbox!! Thanks for all your help $bTimer = True While 1 Send("+") MouseClick("right") If $bTimer = True Then $vTimer = TimerInit() $bTimer = False EndIf If TimerDiff($vTimer) >= 1300 Then MsgBox(0,"","Hello") $bTimer = True EndIf Wend but 1300 means 1300 miliseconds... 1,3 seconds... if you want 1 minute = 60 seconds = 60000 miliseconds
Blindz Posted May 28, 2009 Author Posted May 28, 2009 nuki said: $bTimer = True While 1 Send("+") MouseClick("right") If $bTimer = True Then $vTimer = TimerInit() $bTimer = False EndIf If TimerDiff($vTimer) >= 1300 Then MsgBox(0,"","Hello") $bTimer = True EndIf Wend but 1300 means 1300 miliseconds... 1,3 seconds... if you want 1 minute = 60 seconds = 60000 miliseconds Yeah i know about Millisec same in Vb, i learn it in Vb lol.. anyway Thank you very much thats what i was looking for Thanks alot
Inverted Posted May 29, 2009 Posted May 29, 2009 (edited) stampy said: I'm a little confused. How is checking every second to see if it's run for one minute different than just waiting for one minute?If that is really what you need then you can set a timer with timerinit() and check it every second with timerdiff().Well, obviously the script will be doing other operations in the meantime I'd go with the Adlib solution. Edited May 29, 2009 by Inverted
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