Tycho Posted August 19, 2007 Posted August 19, 2007 Well this is my first time using AutoIT and i was just wondering if someone could help with a pretty basic question... how would i make a script that has 3 While loops? say, ("A" every 30 seconds) ("B" every 90Seconds) ("C" every 120 Seconds)? Any help is much appreciated
Generator Posted August 19, 2007 Posted August 19, 2007 AutoIt is not multi-threaded. Either you make 3 scripts to do this job or put 3 loops in 1.
Tycho Posted August 19, 2007 Author Posted August 19, 2007 AutoIt is not multi-threaded. Either you make 3 scripts to do this job or put 3 loops in 1.thats what i am asking, how would i do 3 loops in 1...
cramaboule Posted August 19, 2007 Posted August 19, 2007 thats what i am asking, how would i do 3 loops in 1...You can use :While/Do/For I would go for While and use sleep()depend what you need !!! My Autoit programs: MAC Address - - Delete Temp Files - - Ping Test - - Play Video with VLC full screen dual monitors - - Set IP - - Pics Converter - - AutoUpdater - - CPU Usage - - Ending Script Nicely - - GDI+ GUI crossfades (slide transitions) - - Beamer - - Search and Search in Files - - Silent Ninite Others: Export Icons into Dll - - My website
Stumpii Posted August 19, 2007 Posted August 19, 2007 Well this is my first time using AutoIT and i was just wondering if someone could help with a pretty basic question...how would i make a script that has 3 While loops? say, ("A" every 30 seconds) ("B" every 90Seconds) ("C" every 120 Seconds)?Any help is much appreciated Here is an example of something you could tryCODE; Script Start - Add your code below here#include <Date.au3>$iFunc1LastTime = _NowCalc()$iFunc2LastTime = _NowCalc()$iFunc3LastTime = _NowCalc()While 1 If _DateDiff( 's',$iFunc1LastTime,_NowCalc()) > 5 Then Func1() EndIf If _DateDiff( 's',$iFunc2LastTime,_NowCalc()) > 10 Then Func2() EndIf If _DateDiff( 's',$iFunc3LastTime,_NowCalc()) > 15 Then Func3() EndIf Sleep(500)WEndFunc Func1() $iFunc1LastTime = _NowCalc() TrayTip("","Func 1",3)EndFuncFunc Func2() $iFunc2LastTime = _NowCalc() TrayTip("","Func 2",3)EndFuncFunc Func3() $iFunc3LastTime = _NowCalc() TrayTip("","Func 3",3)EndFunc Give a man a script; you have helped him for today. Teach a man to script; and you will not have to hear him whine for help.AutoIt4UE - Custom AutoIt toolbar and wordfile for UltraEdit/UEStudio users.AutoIt Graphical Debugger - A graphical debugger for AutoIt.SimMetrics COM Wrapper - Calculate string similarity.
ChrisL Posted August 19, 2007 Posted August 19, 2007 (edited) $timerA = TimerInit() $TimerB = TimerInit() $Timerc = TimerInit() $timerALimitMilliseconds = 30 *1000 $timerBLimitMilliseconds = 90 * 1000 $timerCLimitMilliseconds = 120 * 1000 While 1 If TimerDiff($timerA) >= $timerALimitMilliseconds then _NoHaltMsgBox(0,"timer A",$timerALimitMilliseconds/1000 & " seconds are up",2) $timerA = TImerInit() EndIf If TimerDiff($timerB) >= $timerBLimitMilliseconds then _NoHaltMsgBox(0,"timer B",$timerBLimitMilliseconds/1000 & " seconds are up",2) $timerB = TImerInit() EndIf If TimerDiff($timerC) >= $timerCLimitMilliseconds then _NoHaltMsgBox(0,"timer C",$timerCLimitMilliseconds/1000 & " seconds are up",2) $timerC = TImerInit() EndIf Sleep (100);stops the CPU getting thrashed WEnd Func _NoHaltMsgBox($code=0, $title = "",$text = "" ,$timeout = 0) Run (@AutoItExe & ' /AutoIt3ExecuteLine "MsgBox(' & $code & ', '''& $title & ''', '''& $text &''',' & $timeout & ')"') EndFunc The function _NoHaltMsgbox() is just for demonstration. I used it because it shows the timers without stopping the rest of the script (timers) edit: and before people start you don't need to have autoit installed on a PC to use "Run (@AutoItExe & ' /AutoIt3ExecuteLine )" once your script is compiled! Edited August 19, 2007 by ChrisL [u]Scripts[/u]Minimize gui to systray _ Fail safe source recoveryMsgbox UDF _ _procwatch() Stop your app from being closedLicensed/Trial software system _ Buffering Hotkeys_SQL.au3 ADODB.Connection _ Search 2d Arrays_SplashTextWithGraphicOn() _ Adjust Screen GammaTransparent Controls _ Eventlogs without the crap_GuiCtrlCreateFlash() _ Simple Interscript communication[u]Websites[/u]Curious Campers VW Hightops Lambert Plant Hire
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