Jump to content

Recommended Posts

Posted

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

Posted

  herewasplato said:

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 :)

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

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

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

  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

Posted

  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 :party:
Posted (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 by Inverted

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
  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...