Jump to content

Recommended Posts

Posted

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

  • Moderators
Posted

insignia96,

Sounds like the perfect job for some Adlib functions. :-)

Look at AdlibEnable in the Help file.

M23

Public_Domain.png.2d871819fcb9957cf44f4514551a2935.png 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 columns
ChooseFileFolder ---- Single and multiple selections from specified path treeview listing
Date_Time_Convert -- Easily convert date/time formats, including the language used
ExtMsgBox --------- A highly customisable replacement for MsgBox
GUIExtender -------- Extend and retract multiple sections within a GUI
GUIFrame ---------- Subdivide GUIs into many adjustable frames
GUIListViewEx ------- Insert, delete, move, drag, sort, edit and colour ListView items
GUITreeViewEx ------ Check/clear parent and child checkboxes in a TreeView
Marquee ----------- Scrolling tickertape GUIs
NoFocusLines ------- Remove the dotted focus lines from buttons, sliders, radios and checkboxes
Notify ------------- Small notifications on the edge of the display
Scrollbars ----------Automatically sized scrollbars with a single command
StringSize ---------- Automatically size controls to fit text
Toast -------------- Small GUIs which pop out of the notification area

 

Posted

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)

Posted

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

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
×
×
  • Create New...