I'm hoping someone out there can shed some light on this for me.
I built a GUI that checks on computer systems that are online or offline, right now the user has to click a button to check, I would like the update to happen automatically. I can do this and it works fine as long as all systems are online, however if a computer is offline then the responsiveness of the GUI suffers.
Other than increasing the intervals between checks, I believe I might have to build the code into two functions, one that takes care of the GUI and one that does the pinging of the systems. This way the GUI only has to look at a variable that is updated by the pinging but never has to slow down for the ping to take place, however I cant figure out how to share the information from the second function with the first so it can display an online or offline message to the user.
Any ideas on how to go about doing this would be great.
Sorry for the quick sample, I don't have the actual code with me so I built this for testing different ways of making it work, so far nothing is working correctly, I'm pretty green and have spent a lot of hours online looking for a solution but I have not been able to solve my problem.
#include <GUIConstantsEx.au3>
Local $ping1, $ping2, $i
_Main()
Func _Main()
GUICreate("Test", 500, 300)
$okbutton = GUICtrlCreateButton("OK", 70, 50, 60)
GUISetState(@SW_SHOW)
$i = 1
While 1
$msg = GUIGetMsg()
$i = $i + 1
if $i = 50 Then
$ping1 = Ping("system_abc", 250)
if not $ping1 = 0 Then
GUICtrlCreateLabel("Online", 30, 100)
Else
GUICtrlCreateLabel("Offline", 30, 100)
EndIf
EndIf
if $i = 100 then
$ping2 = Ping("system_123", 250)
if not $ping2 = 0 Then
GUICtrlCreateLabel("Online", 30, 130)
Else
GUICtrlCreateLabel("Offline", 30, 130)
EndIf
$i = 1
EndIf
Select
Case $msg = $GUI_EVENT_CLOSE
ExitLoop
Case $msg = $okbutton
MsgBox(0, "", "some code here for the ok button")
EndSelect
WEnd
EndFunc