insignia96 Posted May 12, 2009 Share Posted May 12, 2009 Okay, What i am wondering about is the presence of multiple While Loops in My GUI. I am writing an application that restarts a few different server applications. Normally this wouldnt be a problem with this code. While 1 If NOT ProcessExists( "MyserverApp.exe" ) Then Run( "C:\My Server\MyServerApp.exe", "C:\My Server\" ) Else EndIf The only problem is i need some apps tobe restartable and some to not be. Also this code uses too much CPU and the server app is very demanding. What i want to do is have it so it checks if App1 is running every second, if app2 is running every 5, and Apps 3 & 4 every .5 seconds. (EXAMPLES) How can i go about this? Thanks for help in advance, Insignia96! Visit my website to see all my finished releases!Releases here:UDFs:GUI ResizingColor List (Web Colors)GUIFade_NearestPower Link to comment Share on other sites More sharing options...
Moderators Melba23 Posted May 12, 2009 Moderators Share Posted May 12, 2009 insignia96,Sounds like the perfect job for some Adlib functions. :-)Look at AdlibEnable in the Help file.M23 Any of my own code posted anywhere on the forum is available for use by others without any restriction of any kind Open spoiler to see my UDFs: Spoiler ArrayMultiColSort ---- Sort arrays on multiple columnsChooseFileFolder ---- Single and multiple selections from specified path treeview listingDate_Time_Convert -- Easily convert date/time formats, including the language usedExtMsgBox --------- A highly customisable replacement for MsgBoxGUIExtender -------- Extend and retract multiple sections within a GUIGUIFrame ---------- Subdivide GUIs into many adjustable framesGUIListViewEx ------- Insert, delete, move, drag, sort, edit and colour ListView itemsGUITreeViewEx ------ Check/clear parent and child checkboxes in a TreeViewMarquee ----------- Scrolling tickertape GUIsNoFocusLines ------- Remove the dotted focus lines from buttons, sliders, radios and checkboxesNotify ------------- Small notifications on the edge of the displayScrollbars ----------Automatically sized scrollbars with a single commandStringSize ---------- Automatically size controls to fit textToast -------------- Small GUIs which pop out of the notification area Link to comment Share on other sites More sharing options...
Triblade Posted May 12, 2009 Share Posted May 12, 2009 Try something with TimerInit and TimerDiff. Then loop multiple checks with that TimerDiff in the While 1 loop. time1 = TimerInit() time2 = TimerInit() While 1 If TimeDiff(time1) >= 1000 Then ; TimeDiff is in milliseconds. So 1000 = 1 sec, 500 = 0,5 sec. Run(App1) time1 = TimerInit() EndIf If TimeDiff(time2) >= 500 Then Run(App2) time2 = TimerInit() EndIf WEnd Mind you, this is from the top of my head and UNTESTED!! My active project(s): A-maze-ing generator (generates a maze) My archived project(s): Pong3 (Multi-pinger) Link to comment Share on other sites More sharing options...
oMBRa Posted May 12, 2009 Share Posted May 12, 2009 Okay, What i am wondering about is the presence of multiple While Loops in My GUI. I am writing an application that restarts a few different server applications. Normally this wouldnt be a problem with this code. While 1 If NOT ProcessExists( "MyserverApp.exe" ) Then Run( "C:\My Server\MyServerApp.exe", "C:\My Server\" ) Else EndIf The only problem is i need some apps tobe restartable and some to not be. Also this code uses too much CPU and the server app is very demanding. What i want to do is have it so it checks if App1 is running every second, if app2 is running every 5, and Apps 3 & 4 every .5 seconds. (EXAMPLES) How can i go about this? Thanks for help in advance, Insignia96!add a Sleep(10) in your While loop, so it doesn't use to much CPU Link to comment Share on other sites More sharing options...
TurionAltec Posted May 12, 2009 Share Posted May 12, 2009 insignia96,Sounds like the perfect job for some Adlib functions. :-)Look at AdlibEnable in the Help file.M23Not just Adlib, but have a look at this adlib udf that lets you have different timings for different loops.http://www.autoitscript.com/forum/index.php?showtopic=83967tossing a sleep in your main while loop will lighten the cpu load. Eg:sleep(200) Link to comment Share on other sites More sharing options...
insignia96 Posted May 12, 2009 Author Share Posted May 12, 2009 Thanks guys the adlib function is what i was looking for and thanks for the lik. The reason i didnt add a sleep is i want different programs to run in diff loops thats why the adlib function sound like it is what i am looking for Thanks! Visit my website to see all my finished releases!Releases here:UDFs:GUI ResizingColor List (Web Colors)GUIFade_NearestPower Link to comment Share on other sites More sharing options...
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