Jump to content

Call function after 1min


Recommended Posts

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
Link to comment
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().

Link to comment
Share on other sites

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
Link to comment
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().

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
Link to comment
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

Link to comment
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:
Link to comment
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().

Well, obviously the script will be doing other operations in the meantime :)

I'd go with the Adlib solution.

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