Sign in to follow this  
Followers 0
Blindz

Call function after 1min

11 posts in this topic

Hi, I'm new at Autoit! and im now working on a little project for me and my friend! but im stuck :party: 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

Share this post


Link to post
Share on other sites



Welcome to the forum.

Look in the help file under Sleep or TimerInit


[size="1"][font="Arial"].[u].[/u][/font][/size]

Share this post


Link to post
Share on other sites

Welcome to the forum.

Look in the help file under Sleep or TimerInit

hmm not sure how to use it!! i dont know how to calls my function after 1 min :)

Share this post


Link to post
Share on other sites

sleep(60000) ;<<<sleep one minute
test()            ;<<<run the test function

Share this post


Link to post
Share on other sites

#5 ·  Posted (edited)

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 by Blindz

Share this post


Link to post
Share on other sites

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().

Share this post


Link to post
Share on other sites

#7 ·  Posted (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 by nuki

Share this post


Link to post
Share on other sites

#8 ·  Posted (edited)

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 by Blindz

Share this post


Link to post
Share on other sites

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

Share this post


Link to post
Share on other sites

$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 :party:

Share this post


Link to post
Share on other sites

#11 ·  Posted (edited)

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 by Inverted

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