Sign in to follow this  
Followers 0
Smurfin

how to make a timer inside a loop

4 posts in this topic

can anyone please teach me how to make a timer inside a main program loop, so the timer will only execute a certain function after like 30 minutes and the loops goes on without executing this one function again, only after the next 30 minutes it will be executed again.

thanks in advance.

Share this post


Link to post
Share on other sites



@Smurfin

Maybe...

$Init = TimerInit()

While 1
    Sleep(250)
    If TimerDiff($Init) >= 180000 Then ExitLoop
WEnd

;Start your script

Cheers, FireFox.


 

OS : Win XP SP2 (32 bits) / Win 7 SP1 (64 bits) / Win 8 (64 bits) | Autoit version: latest stable / beta.
Hardware : Intel(R) Core(TM) i5-2400 CPU @ 3.10Ghz / 8 GiB RAM DDR3.

My UDFs : Skype UDF | TrayIconEx UDF | GUI Panel UDF | Excel XML UDF | Is_Pressed_UDF

My Projects : YouTube Multi-downloader | FTP Easy-UP | Lock'n | WinKill | AVICapture | Skype TM | Tap Maker | ShellNew | Scriptner | Const Replacer | FT_Pocket | Chrome theme maker

My Examples : Capture toolIP Camera | Crosshair | Draw Captured Region | Picture Screensaver | Jscreenfix | Drivetemp | Picture viewer

My Snippets : Basic TCP | Systray_GetIconIndex | Intercept End task | Winpcap various | Advanced HotKeySet | Transparent Edit control

 

Share this post


Link to post
Share on other sites

you could use adlibenable or

$timer=TimerInit()

$time=30*60*1000
While 1
    ToolTip(Round(TimerDiff($timer)/1000,2),0,0)
    If TimerDiff($timer)>$time Then
        $timer=TimerInit()
        MsgBox(0 , "" , "test msgbox")
    EndIf
    Sleep(10)
WEnd

now you just have to decide where to put the second timerinit

just after the if or just before the endif:P


Only two things are infinite, the universe and human stupidity, and i'm not sure about the former -Alber EinsteinPractice makes perfect! but nobody's perfect so why practice at all?http://forum.ambrozie.ro

Share this post


Link to post
Share on other sites

thanks everyone, I'll try to figure out how to fit these scripts to use with my existing scripts. I'll post again later if I got stuck.

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