Jump to content

Need help refreshing data in window


Go to solution Solved by DanielMathis,

Recommended Posts

Hey Guys, I'm somewhat new to scripting and new to the site. I can't for the life of me figure out how to get the data to be "live"

I'm working on a dashboard to use at work for monitoring services on remote servers; Starting, Stopping said services and also the servers themselves.

I've figure out the restarting remote PC's part and services part, but I can't figure out how to get the data on the window to be somewhat live like refresh every 2-3 seconds.

for the remote services, I figured out 2 ways of querying their status. Pros? Cons? to the 2 ways.

example1:

$status1 = _ServiceStatus("AdobeARMservice", "spiceworks")
If $status1 = "Running" Then
$var1 = "Running"
Else 
$var1 = "Not Running"
EndIf
 

then later on in the code, GUICtrlCreateLabel( $var1, 413, 150, 119, 17)

example2:

$status1 = Run('sc spiceworks query "AdobeARMservice"', '', @SW_HIDE, 2)
 
Global $return
Do
   $return &= StdoutRead($status1)
Until @error
 
If StringInStr($return, 'Running') Then
$var1 = "Running"
Else 
$var1 = "Not Running"
EndIf

 

then later on in the code, GUICtrlCreateLabel( $var1, 413, 150, 119, 17)

------------------------------------------------------------------------------------------------------------------

But How do I "rerun the status check and then refresh the label?

Thanks

Daniel 

Link to comment
Share on other sites

DanielMathis

Welcome to the forum

Please read this.

Signature beginning:
Please remember: "AutoIt"..... *  Wondering who uses AutoIt and what it can be used for ? * Forum Rules *
ADO.au3 UDF * POP3.au3 UDF * XML.au3 UDF * IE on Windows 11 * How to ask ChatGPT for AutoIt Codefor other useful stuff click the following button:

Spoiler

Any of my own code posted anywhere on the forum is available for use by others without any restriction of any kind. 

My contribution (my own projects): * Debenu Quick PDF Library - UDF * Debenu PDF Viewer SDK - UDF * Acrobat Reader - ActiveX Viewer * UDF for PDFCreator v1.x.x * XZip - UDF * AppCompatFlags UDF * CrowdinAPI UDF * _WinMergeCompare2Files() * _JavaExceptionAdd() * _IsBeta() * Writing DPI Awareness App - workaround * _AutoIt_RequiredVersion() * Chilkatsoft.au3 UDF * TeamViewer.au3 UDF * JavaManagement UDF * VIES over SOAP * WinSCP UDF * GHAPI UDF - modest begining - comunication with GitHub REST APIErrorLog.au3 UDF - A logging Library * Include Dependency Tree (Tool for analyzing script relations) * Show_Macro_Values.au3 *

 

My contribution to others projects or UDF based on  others projects: * _sql.au3 UDF  * POP3.au3 UDF *  RTF Printer - UDF * XML.au3 UDF * ADO.au3 UDF SMTP Mailer UDF * Dual Monitor resolution detection * * 2GUI on Dual Monitor System * _SciLexer.au3 UDF * SciTE - Lexer for console pane

Useful links: * Forum Rules * Forum etiquette *  Forum Information and FAQs * How to post code on the forum * AutoIt Online Documentation * AutoIt Online Beta Documentation * SciTE4AutoIt3 getting started * Convert text blocks to AutoIt code * Games made in Autoit * Programming related sites * Polish AutoIt Tutorial * DllCall Code Generator * 

Wiki: Expand your knowledge - AutoIt Wiki * Collection of User Defined Functions * How to use HelpFile * Good coding practices in AutoIt * 

OpenOffice/LibreOffice/XLS Related: WriterDemo.au3 * XLS/MDB from scratch with ADOX

IE Related:  * How to use IE.au3  UDF with  AutoIt v3.3.14.x * Why isn't Autoit able to click a Javascript Dialog? * Clicking javascript button with no ID * IE document >> save as MHT file * IETab Switcher (by LarsJ ) * HTML Entities * _IEquerySelectorAll() (by uncommon) * IE in TaskSchedulerIE Embedded Control Versioning (use IE9+ and HTML5 in a GUI) * PDF Related:How to get reference to PDF object embeded in IE * IE on Windows 11

I encourage you to read: * Global Vars * Best Coding Practices * Please explain code used in Help file for several File functions * OOP-like approach in AutoIt * UDF-Spec Questions *  EXAMPLE: How To Catch ConsoleWrite() output to a file or to CMD *

I also encourage you to check awesome @trancexx code:  * Create COM objects from modules without any demand on user to register anything. * Another COM object registering stuffOnHungApp handlerAvoid "AutoIt Error" message box in unknown errors  * HTML editor

winhttp.au3 related : * https://www.autoitscript.com/forum/topic/206771-winhttpau3-download-problem-youre-speaking-plain-http-to-an-ssl-enabled-server-port/

"Homo sum; humani nil a me alienum puto" - Publius Terentius Afer
"Program are meant to be read by humans and only incidentally for computers and execute" - Donald Knuth, "The Art of Computer Programming"
:naughty:  :ranting:, be  :) and       \\//_.

Anticipating Errors :  "Any program that accepts data from a user must include code to validate that data before sending it to the data store. You cannot rely on the data store, ...., or even your programming language to notify you of problems. You must check every byte entered by your users, making sure that data is the correct type for its field and that required fields are not empty."

Signature last update: 2023-04-24

Link to comment
Share on other sites

#include <GUIConstantsEx.au3>
#include <NTServices.au3>
#include <ButtonConstants.au3>
#include <ComboConstants.au3>
#include <GUIConstantsEx.au3>
#include <StaticConstants.au3>
#include <TabConstants.au3>
#include <WindowsConstants.au3>


#Region ### START Koda GUI section ### Form=c:\users\dmathis\downloads\koda_1.7.3.0\forms\demo.kxf
$Form1_1 = GUICreate("Imaging", 1317, 905, 210, 113)

;Title
$Title = GUICtrlCreateLabel("Imaging Weekly Reboot Maintenance", 7, 11, 1309, 29, $SS_CENTER)
GUICtrlSetFont(-1, 16, 400, 0, "Verdana")

;Headings
$Heading1 = GUICtrlCreateLabel("Server Name", 7, 51, 143, 29)
GUICtrlSetFont(-1, 16, 400, 0, "Verdana")
$Heading2 = GUICtrlCreateLabel("Restart Server", 187, 51, 158, 29)
GUICtrlSetFont(-1, 16, 400, 0, "Verdana")
$Heading3 = GUICtrlCreateLabel("Server Status", 401, 51, 148, 29)
GUICtrlSetFont(-1, 16, 400, 0, "Verdana")
$Heading4 = GUICtrlCreateLabel("Service", 616, 51, 150, 29, $SS_CENTER)
GUICtrlSetFont(-1, 16, 400, 0, "Verdana")
$Heading5 = GUICtrlCreateLabel("Status", 800, 51, 150, 29, $SS_CENTER)
GUICtrlSetFont(-1, 16, 400, 0, "Verdana")
$Heading6 = GUICtrlCreateLabel("Start Service", 976, 51, 150, 27, $SS_CENTER)
GUICtrlSetFont(-1, 14, 400, 0, "Verdana")
$Heading7 = GUICtrlCreateLabel("Stop Service", 1158, 51, 150, 27, $SS_CENTER)
GUICtrlSetFont(-1, 14, 400, 0, "Verdana")

;Servers
$Server1 = GUICtrlCreateLabel("RIS-Asadb", 10, 90, 150, 22, $SS_CENTER)
GUICtrlSetFont(-1, 12, 400, 0, "Verdana")
$Server2 = GUICtrlCreateLabel("RIS-Asapp", 10, 154, 150, 22, $SS_CENTER)
GUICtrlSetFont(-1, 12, 400, 0, "Verdana")
$Server3 = GUICtrlCreateLabel("RIS-Docdb", 10, 346, 150, 22, $SS_CENTER)
GUICtrlSetFont(-1, 12, 400, 0, "Verdana")
$Server4 = GUICtrlCreateLabel("RIS-Docapp", 10, 410, 150, 22, $SS_CENTER)
GUICtrlSetFont(-1, 12, 400, 0, "Verdana")
$Server5 = GUICtrlCreateLabel("RIS-Dashboards", 10, 538, 150, 22, $SS_CENTER)
GUICtrlSetFont(-1, 12, 400, 0, "Verdana")
$Server6 = GUICtrlCreateLabel("Pacs-Production", 10, 723, 150, 22, $SS_CENTER)
GUICtrlSetFont(-1, 12, 400, 0, "Verdana")
$Server7 = GUICtrlCreateLabel("Pacs-Cont", 10, 785, 150, 22, $SS_CENTER)
GUICtrlSetFont(-1, 12, 400, 0, "Verdana")
$Server8 = GUICtrlCreateLabel("HHIServer", 10, 837, 150, 22, $SS_CENTER)
GUICtrlSetFont(-1, 12, 400, 0, "Verdana")

;Server Status Check and Set to Variable

$risasadb = _ServiceStatus("ProfSvc", "172.20.14.162")
If $risasadb = "Running" Then
$Server1Status= "Running"
Else 
$Server1Status = "Not Running"
EndIf

$risasapp = _ServiceStatus("ProfSvc", "172.20.14.162")
If $risasapp = "Running" Then
$Server2Status = "Running"
Else 
$Server2Status = "Not Running"
EndIf

$risdocdb = _ServiceStatus("ProfSvc", "172.20.14.163")
If $risdocdb = "Running" Then
$Server3Status = "Running"
Else 
$Server3Status = "Not Running"
EndIf

$risdocapp = _ServiceStatus("ProfSvc", "172.20.14.163")
If $risdocapp = "Running" Then
$Server4Status = "Running"
Else 
$Server4Status = "Not Running"
EndIf

$risdashboard = _ServiceStatus("ProfSvc", "172.20.14.163")
If $risdashboard = "Running" Then
$Server5Status = "Running"
Else 
$Server5Status = "Not Running"
EndIf

$pacsproduction = _ServiceStatus("ProfSvc", "172.20.14.163")
If $pacsproduction = "Running" Then
$Server6Status = "Running"
Else 
$Server6Status = "Not Running"
EndIf

$pacscont = _ServiceStatus("ProfSvc", "172.20.14.163")
If $pacscont = "Running" Then
$Server7Status = "Running"
Else 
$Server7Status = "Not Running"
EndIf

$hhiserver = _ServiceStatus("ProfSvc", "172.20.14.163")
If $hhiserver = "Running" Then
$Server8Status = "Running"
Else 
$Server8Status = "Not Running"
EndIf

;Server Status
GUICtrlCreateLabel($Server1Status, 400, 94, 150, 17, $SS_CENTER)
GUICtrlCreateLabel($Server2Status, 400, 158, 150, 17, $SS_CENTER)
GUICtrlCreateLabel($Server3Status, 400, 350, 150, 17, $SS_CENTER)
GUICtrlCreateLabel($Server4Status, 400, 414, 150, 17, $SS_CENTER)
GUICtrlCreateLabel($Server5Status, 400, 542, 150, 17, $SS_CENTER)
GUICtrlCreateLabel($Server6Status, 400, 724, 150, 17, $SS_CENTER)
GUICtrlCreateLabel($Server7Status, 400, 786, 150, 17, $SS_CENTER)
GUICtrlCreateLabel($Server8Status, 400, 838, 150, 17, $SS_CENTER)

;Service Check and Set to Variable

$RisSqlStatus = _ServiceStatus("MSSQLSERVER", "172.20.14.162")
If $RisSqlStatus = "Running" Then
$Server1Label1Status = "Running"
Else 
$Server1Label1Status = "Not Running"
EndIf

$RisSqlAgentStatus = _ServiceStatus("SQLSERVERAGENT", "172.20.14.162")
If $RisSqlAgentStatus = "Running" Then
$Server1Label2Status = "Running"
Else 
$Server1Label2Status = "Not Running"
EndIf

$RisAmicasStatus = _ServiceStatus("AmicasVisionSeriesRisServer", "172.20.14.163")
If $RisAmicasStatus = "Running" Then
$Server2Label1Status = "Running"
Else 
$Server2Label1Status = "Not Running"
EndIf

$RisBrookTroutStatus = _ServiceStatus("bostservice", "172.20.14.163")
If $RisBrookTroutStatus = "Running" Then
$Server2Label2Status = "Running"
Else 
$Server2Label2Status = "Not Running"
EndIf

$RisDocEngineStatus = _ServiceStatus("DocConverterEngine", "172.20.14.163")
If $RisDocEngineStatus = "Running" Then
$Server2Label3Status = "Running"
Else 
$Server2Label3Status = "Not Running"
EndIf

$RisFaxStatus = _ServiceStatus("FAXmaker Fax Server", "172.20.14.163")
If $RisFaxStatus = "Running" Then
$Server2Label4Status = "Running"
Else 
$Server2Label4Status = "Not Running"
EndIf

$RisFaxAgentStatus = _ServiceStatus("FAXmaker MTA Service", "172.20.14.163")
If $RisFaxAgentStatus = "Running" Then
$Server2Label5Status = "Running"
Else 
$Server2Label5Status = "Not Running"
EndIf

$RisFaxWsapiStatus = _ServiceStatus("GFI FaxMaker WSAPI", "172.20.14.163")
If $RisFaxWsapiStatus = "Running" Then
$Server2Label6Status = "Running"
Else 
$Server2Label6Status = "Not Running"
EndIf

$RisDocSqlStatus = _ServiceStatus("MSSQL$SCMDOCDB", "172.20.14.164")
If $RisDocSqlStatus = "Running" Then
$Server3Label1Status = "Running"
Else 
$Server3Label1Status = "Not Running"
EndIf

$RisDocSqlAgentStatus = _ServiceStatus("SQLAgent$SCMDOCDB", "172.20.14.164")
If $RisDocSqlAgentStatus = "Running" Then
$Server3Label2Status = "Running"
Else 
$Server3Label2Status = "Not Running"
EndIf

$RisDocHL7AnalyzerStatus = _ServiceStatus("MDMHL7Analyzer", "172.20.14.165")
If $RisDocHL7AnalyzerStatus = "Running" Then
$Server4Label1Status = "Running"
Else 
$Server4Label1Status = "Not Running"
EndIf

$RisDocHL7ProcessorStatus = _ServiceStatus("MDMHL7Processor", "172.20.14.165")
If $RisDocHL7ProcessorStatus = "Running" Then
$Server4Label2Status = "Running"
Else 
$Server4Label2Status = "Not Running"
EndIf

$RisDocHL7ReceiverStatus = _ServiceStatus("MDMHL7Receiver", "172.20.14.165")
If $RisDocHL7ReceiverStatus = "Running" Then
$Server4Label3Status = "Running"
Else 
$Server4Label3Status = "Not Running"
EndIf

$RisDocHL7JobStatus = _ServiceStatus("MDMJobMonitor", "172.20.14.165")
If $RisDocHL7JobStatus = "Running" Then
$Server4Label4Status = "Running"
Else 
$Server4Label4Status = "Not Running"
EndIf
;
$RisDashSqlStatus = _ServiceStatus("MSSQLSERVER", "172.20.14.169")
If $RisDashSqlStatus = "Running" Then
$Server5Label1Status = "Running"
Else 
$Server5Label1Status = "Not Running"
EndIf

$RisDashSqlAgentStatus = _ServiceStatus("SQLSERVERAGENT", "172.20.14.169")
If $RisDashSqlAgentStatus = "Running" Then
$Server5Label2Status = "Running"
Else 
$Server5Label2Status = "Not Running"
EndIf

$RisDashBiStatus = _ServiceStatus("BI ETL", "172.20.14.169")
If $RisDashBiStatus = "Running" Then
$Server5Label3Status = "Running"
Else 
$Server5Label3Status = "Not Running"
EndIf

$RisDashIBMStatus = _ServiceStatus("IBM Cognos", "172.20.14.169")
If $RisDashIBMStatus = "Running" Then
$Server5Label4Status = "Running"
Else 
$Server5Label4Status = "Not Running"
EndIf


;Server1 Service Name and Status
GUICtrlCreateLabel("SQL", 616, 94, 150, 17, $SS_CENTER)
GUICtrlCreateLabel($Server1Label1Status, 800, 94, 150, 17, $SS_CENTER)
GUICtrlCreateLabel("SQL Agent", 616, 126, 150, 17, $SS_CENTER)
GUICtrlCreateLabel($Server1Label2Status, 800, 126, 150, 17, $SS_CENTER)

;Server2 Service Name and Status
GUICtrlCreateLabel("AMICAS VSRIS", 616, 158, 150, 17, $SS_CENTER)
GUICtrlCreateLabel($Server2Label1Status, 800, 158, 150, 17, $SS_CENTER)
GUICtrlCreateLabel("Brooktrout Boston Host", 616, 190, 150, 17, $SS_CENTER)
GUICtrlCreateLabel($Server2Label2Status, 800, 190, 150, 17, $SS_CENTER)
GUICtrlCreateLabel("DocConverter MRIS", 616, 222, 150, 17, $SS_CENTER)
GUICtrlCreateLabel($Server2Label3Status, 800, 222, 150, 17, $SS_CENTER)
GUICtrlCreateLabel("GFI FaxMaker Server", 616, 254, 150, 17, $SS_CENTER)
GUICtrlCreateLabel($Server2Label4Status, 800, 254, 150, 17, $SS_CENTER)
GUICtrlCreateLabel("GFI Message Transfer Agent", 616, 286, 150, 17, $SS_CENTER)
GUICtrlCreateLabel($Server2Label5Status, 800, 286, 150, 17, $SS_CENTER)
GUICtrlCreateLabel("WSAPI", 616, 318, 150, 17, $SS_CENTER)
GUICtrlCreateLabel($Server2Label6Status, 800, 318, 150, 17, $SS_CENTER)

;Server3 Service Name and Status
GUICtrlCreateLabel("SQL", 616, 350, 150, 17, $SS_CENTER)
GUICtrlCreateLabel($Server3Label1Status, 800, 350, 150, 17, $SS_CENTER)
GUICtrlCreateLabel("SQL Agent", 616, 380, 150, 17, $SS_CENTER)
GUICtrlCreateLabel($Server3Label2Status, 800, 382, 150, 17, $SS_CENTER)

;Server4 Service Name and Status
GUICtrlCreateLabel("HL7 Analyzer", 616, 414, 150, 17, $SS_CENTER)
GUICtrlCreateLabel($Server4Label1Status, 800, 414, 150, 17, $SS_CENTER)
GUICtrlCreateLabel("HL7 Processor", 616, 446, 150, 17, $SS_CENTER)
GUICtrlCreateLabel($Server4Label2Status, 800, 446, 150, 17, $SS_CENTER)
GUICtrlCreateLabel("HL7 Receiver", 616, 478, 150, 17, $SS_CENTER)
GUICtrlCreateLabel($Server4Label3Status, 800, 478, 150, 17, $SS_CENTER)
GUICtrlCreateLabel("HL7 Job Monitor", 616, 510, 150, 17, $SS_CENTER)
GUICtrlCreateLabel($Server4Label4Status, 800, 510, 150, 17, $SS_CENTER)

;Server5 Service Name and Status
GUICtrlCreateLabel("SQL", 616, 542, 150, 17, $SS_CENTER)
GUICtrlCreateLabel($Server5Label1Status, 800, 542, 150, 17, $SS_CENTER)
GUICtrlCreateLabel("SQL Agent", 616, 574, 150, 17, $SS_CENTER)
GUICtrlCreateLabel($Server5Label2Status, 800, 574, 150, 17, $SS_CENTER)
GUICtrlCreateLabel("BI ETL", 616, 606, 150, 17, $SS_CENTER)
GUICtrlCreateLabel($Server5Label3Status, 800, 606, 150, 17, $SS_CENTER)
GUICtrlCreateLabel("IBM Cognos", 616, 638, 150, 17, $SS_CENTER)
GUICtrlCreateLabel($Server5Label4Status, 800, 638, 150, 17, $SS_CENTER)

;Service Start Buttons
$Button60 = GUICtrlCreateButton("Start", 1006, 88, 81, 25)
$Button61 = GUICtrlCreateButton("Start", 1006, 120, 81, 25)
$Button62 = GUICtrlCreateButton("Start", 1006, 152, 81, 25)
$Button63 = GUICtrlCreateButton("Start", 1006, 184, 81, 25)
$Button64 = GUICtrlCreateButton("Start", 1006, 216, 81, 25)
$Button65 = GUICtrlCreateButton("Start", 1006, 248, 81, 25)
$Button66 = GUICtrlCreateButton("Start", 1006, 280, 81, 25)
$Button67 = GUICtrlCreateButton("Start", 1006, 312, 81, 25)
$Button68 = GUICtrlCreateButton("Start", 1006, 344, 81, 25)
$Button69 = GUICtrlCreateButton("Start", 1006, 376, 81, 25)
$Button70 = GUICtrlCreateButton("Start", 1006, 408, 81, 25)
$Button71 = GUICtrlCreateButton("Start", 1006, 440, 81, 25)
$Button72 = GUICtrlCreateButton("Start", 1006, 472, 81, 25)
$Button73 = GUICtrlCreateButton("Start", 1006, 504, 81, 25)
$Button74 = GUICtrlCreateButton("Start", 1006, 536, 81, 25)
$Button75 = GUICtrlCreateButton("Start", 1006, 568, 81, 25)
$Button76 = GUICtrlCreateButton("Start", 1006, 600, 81, 25)
$Button77 = GUICtrlCreateButton("Start", 1006, 632, 81, 25)

;Service Stop Buttons
$Button80 = GUICtrlCreateButton("Stop", 1190, 88, 81, 25)
$Button81 = GUICtrlCreateButton("Stop", 1190, 120, 81, 25)
$Button82 = GUICtrlCreateButton("Stop", 1190, 152, 81, 25)
$Button83 = GUICtrlCreateButton("Stop", 1190, 184, 81, 25)
$Button84 = GUICtrlCreateButton("Stop", 1190, 216, 81, 25)
$Button85 = GUICtrlCreateButton("Stop", 1190, 248, 81, 25)
$Button86 = GUICtrlCreateButton("Stop", 1190, 280, 81, 25)
$Button87 = GUICtrlCreateButton("Stop", 1190, 312, 81, 25)
$Button88 = GUICtrlCreateButton("Stop", 1190, 344, 81, 25)
$Button89 = GUICtrlCreateButton("Stop", 1190, 376, 81, 25)
$Button90 = GUICtrlCreateButton("Stop", 1190, 408, 81, 25)
$Button91 = GUICtrlCreateButton("Stop", 1190, 440, 81, 25)
$Button92 = GUICtrlCreateButton("Stop", 1190, 472, 81, 25)
$Button93 = GUICtrlCreateButton("Stop", 1190, 504, 81, 25)
$Button94 = GUICtrlCreateButton("Stop", 1190, 536, 81, 25)
$Button95 = GUICtrlCreateButton("Stop", 1190, 568, 81, 25)
$Button96 = GUICtrlCreateButton("Stop", 1190, 600, 81, 25)
$Button97 = GUICtrlCreateButton("Stop", 1190, 632, 81, 25)

; Server Restart Buttons
$Server1Restart = GUICtrlCreateButton("Restart", 223, 88, 81, 25)
$Server2Restart = GUICtrlCreateButton("Restart", 223, 152, 81, 25)
$Server3Restart = GUICtrlCreateButton("Restart", 223, 344, 81, 25)
$Server4Restart = GUICtrlCreateButton("Restart", 223, 408, 81, 25)
$Server5Restart = GUICtrlCreateButton("Restart", 223, 536, 81, 25)
$Server6Restart = GUICtrlCreateButton("Restart", 223, 721, 81, 25)
$Server7Restart = GUICtrlCreateButton("Restart", 223, 783, 81, 25)
$Server8Restart = GUICtrlCreateButton("Restart", 223, 835, 81, 25)



GUISetState(@SW_SHOW)
#EndRegion ### END Koda GUI section ###

While 1
    $nMsg = GUIGetMsg()
    Switch $nMsg
        Case $GUI_EVENT_CLOSE
            Exit
         
         Case $Server1Restart
            RestartServer1()
         
         Case $Server2Restart
            RestartServer2()
         
         Case $Server3Restart
            RestartServer3()
         
         Case $Server4Restart
            RestartServer4()
         
         Case $Server5Restart
            RestartServer5()
         
         Case $Server6Restart
            RestartServer6()
         
         Case $Server7Restart
            RestartServer7()
         
         Case $Server8Restart
            RestartServer8()
         
         Case $Button60
            Server1Service1Start()
         
         Case $Button61
            Server1Service2Start()
         
         Case $Button62
            Server2Service1Start()
         
         Case $Button63
            Server2Service2Start()
         
         Case $Button64
            Server2Service3Start()
         
         Case $Button65
            Server2Service4Start()
         
         Case $Button66
            Server2Service5Start()
         
         Case $Button67
            Server2Service6Start()
         
         Case $Button68
            Server3Service1Start()
         
         Case $Button69
            Server3Service2Start()
         
         Case $Button70
            Server4Service1Start()
         
         Case $Button71
            Server4Service2Start()
         
         Case $Button72
            Server4Service3Start()
         
         Case $Button73
            Server4Service4Start()
         
         Case $Button74
            Server5Service1Start()
         
         Case $Button75
            Server5Service2Start()
         
         Case $Button76
            Server5Service3Start()
         
         Case $Button77
            Server5Service4Start()
            
         Case $Button80
            Server1Service1Stop()
         
         Case $Button81
            Server1Service2Stop()
         
         Case $Button82
            Server2Service1Stop()
         
         Case $Button83
            Server2Service2Stop()
         
         Case $Button84
            Server2Service3Stop()
         
         Case $Button85
            Server2Service4Stop()
         
         Case $Button86
            Server2Service5Stop()
         
         Case $Button87
            Server2Service6Stop()
         
         Case $Button88
            Server3Service1Stop()
         
         Case $Button89
            Server3Service2Stop()
         
         Case $Button90
            Server4Service1Stop()
         
         Case $Button91
            Server4Service2Stop()
         
         Case $Button92
            Server4Service3Stop()
         
         Case $Button93
            Server4Service4Stop()
         
         Case $Button94
            Server5Service1Stop()
         
         Case $Button95
            Server5Service2Stop()
         
         Case $Button96
            Server5Service3Stop()
         
         Case $Button97
            Server5Service4Stop()
            
    EndSwitch
WEnd

;Restart Functions
Func RestartServer1()
   run("shutdown.exe -m \\172.20.14.162 -f -r")
EndFunc
Func RestartServer2()
   run("shutdown.exe -m \\172.20.14.163 -f -r")
EndFunc
Func RestartServer3()
   run("shutdown.exe -m \\172.20.14.164 -f -r")
EndFunc
Func RestartServer4()
   run("shutdown.exe -m \\172.20.14.165 -f -r")
EndFunc
Func RestartServer5()
   run("shutdown.exe -m \\172.20.14.169 -f -r")
EndFunc
Func RestartServer6()
   run("shutdown.exe -m \\pacs-production -f -r")
EndFunc
Func RestartServer7()
   run("shutdown.exe -m \\172.20.14.159 -f -r")
EndFunc
Func RestartServer8()
   run("shutdown.exe -m \\192.168.21.5 -f -r")
EndFunc

;Service Start Functions
Func Server1Service1Start()
   Run('sc \\172.20.14.162 start "MSSQLSERVER"', '', @SW_HIDE, 2)
EndFunc
Func Server1Service2Start()
   Run('sc \\172.20.14.162 start "SQLSERVERAGENT"', '', @SW_HIDE, 2)
EndFunc
Func Server2Service1Start()
   Run('sc \\172.20.14.163 start "AmicasVisionSeriesRisServer"', '', @SW_HIDE, 2)
EndFunc
Func Server2Service2Start()
   Run('sc \\172.20.14.163 start "bostservice"', '', @SW_HIDE, 2)
EndFunc
Func Server2Service3Start()
   Run('sc \\172.20.14.163 start "DocConverterEngine"', '', @SW_HIDE, 2)
EndFunc
Func Server2Service4Start()
   Run('sc \\172.20.14.163 start "FAXmaker Fax Server"', '', @SW_HIDE, 2)
EndFunc
Func Server2Service5Start()
   Run('sc \\172.20.14.163 start "FAXmaker MTA Service"', '', @SW_HIDE, 2)
EndFunc
Func Server2Service6Start()
   Run('sc \\172.20.14.163 start "GFI FaxMaker WSAPI"', '', @SW_HIDE, 2)
EndFunc
Func Server3Service1Start()
   Run('sc \\172.20.14.164 start "MSSQL$SCMDOCDB"', '', @SW_HIDE, 2)
EndFunc
Func Server3Service2Start()
   Run('sc \\172.20.14.164 start "SQLAgent$SCMDOCDB"', '', @SW_HIDE, 2)
EndFunc
Func Server4Service1Start()
   Run('sc \\172.20.14.165 start "MDMHL7Analyzer"', '', @SW_HIDE, 2)
EndFunc
Func Server4Service2Start()
   Run('sc \\172.20.14.165 start "MDMHL7Processor"', '', @SW_HIDE, 2)
EndFunc
Func Server4Service3Start()
   Run('sc \\172.20.14.165 start "MDMHL7Receiver"', '', @SW_HIDE, 2)
EndFunc
Func Server4Service4Start()
   Run('sc \\172.20.14.165 start "MDMJobMonitor"', '', @SW_HIDE, 2)
EndFunc
Func Server5Service1Start()
   Run('sc \\172.20.14.169 start "MSSQLSERVER"', '', @SW_HIDE, 2)
EndFunc
Func Server5Service2Start()
   Run('sc \\172.20.14.169 start "SQLSERVERAGENT"', '', @SW_HIDE, 2)
EndFunc
Func Server5Service3Start()
   Run('sc \\172.20.14.169 start "BI ETL"', '', @SW_HIDE, 2)
EndFunc
Func Server5Service4Start()
   Run('sc \\172.20.14.169 start "IBM Cognos"', '', @SW_HIDE, 2)
EndFunc

;Service Stop Functions
Func Server1Service1Stop()
   Run('sc \\172.20.14.162 stop "MSSQLSERVER"', '', @SW_HIDE, 2)
EndFunc
Func Server1Service2Stop()
   Run('sc \\172.20.14.162 stop "SQLSERVERAGENT"', '', @SW_HIDE, 2)
EndFunc
Func Server2Service1Stop()
   Run('sc \\172.20.14.163 stop "AmicasVisionSeriesRisServer"', '', @SW_HIDE, 2)
EndFunc
Func Server2Service2Stop()
   Run('sc \\172.20.14.163 stop "bostservice"', '', @SW_HIDE, 2)
EndFunc
Func Server2Service3Stop()
   Run('sc \\172.20.14.163 stop "DocConverterEngine"', '', @SW_HIDE, 2)
EndFunc
Func Server2Service4Stop()
   Run('sc \\172.20.14.163 stop "FAXmaker Fax Server"', '', @SW_HIDE, 2)
EndFunc
Func Server2Service5Stop()
   Run('sc \\172.20.14.163 stop "FAXmaker MTA Service"', '', @SW_HIDE, 2)
EndFunc
Func Server2Service6Stop()
   Run('sc \\172.20.14.163 stop "GFI FaxMaker WSAPI"', '', @SW_HIDE, 2)
EndFunc
Func Server3Service1Stop()
   Run('sc \\172.20.14.164 stop "MSSQL$SCMDOCDB"', '', @SW_HIDE, 2)
EndFunc
Func Server3Service2Stop()
   Run('sc \\172.20.14.164 stop "SQLAgent$SCMDOCDB"', '', @SW_HIDE, 2)
EndFunc
Func Server4Service1Stop()
   Run('sc \\172.20.14.165 stop "MDMHL7Analyzer"', '', @SW_HIDE, 2)
EndFunc
Func Server4Service2Stop()
   Run('sc \\172.20.14.165 stop "MDMHL7Processor"', '', @SW_HIDE, 2)
EndFunc
Func Server4Service3Stop()
   Run('sc \\172.20.14.165 stop "MDMHL7Receiver"', '', @SW_HIDE, 2)
EndFunc
Func Server4Service4Stop()
   Run('sc \\172.20.14.165 stop "MDMJobMonitor"', '', @SW_HIDE, 2)
EndFunc
Func Server5Service1Stop()
   Run('sc \\172.20.14.169 stop "MSSQLSERVER"', '', @SW_HIDE, 2)
EndFunc
Func Server5Service2Stop()
   Run('sc \\172.20.14.169 stop "SQLSERVERAGENT"', '', @SW_HIDE, 2)
EndFunc
Func Server5Service3Stop()
   Run('sc \\172.20.14.169 stop "BI ETL"', '', @SW_HIDE, 2)
EndFunc
Func Server5Service4Stop()
   Run('sc \\172.20.14.169 stop "IBM Cognos"', '', @SW_HIDE, 2)
EndFunc

Edited by DanielMathis
Link to comment
Share on other sites

Please look over the code and point out any issues you see with it. I'm not to sure about placement of things. If everything looks ok, I just need help figuring out how/where to get the program to check the services every 2 seconds and refresh the status on the window.

I don't know if a "Refresh" Button written in somewhere would be easier or even possible.

Look forward to every bodies view and help on this.

Thanks

Link to comment
Share on other sites

For a start, all the labels similar to and including 

GUICtrlCreateLabel($Server1Status, 400, 94, 150, 17, $SS_CENTER)
GUICtrlCreateLabel($Server2Status, 400, 158, 150, 17, $SS_CENTER)
GUICtrlCreateLabel($Server3Status, 400, 350, 150, 17, $SS_CENTER)
GUICtrlCreateLabel($Server4Status, 400, 414, 150, 17, $SS_CENTER)
GUICtrlCreateLabel($Server5Status, 400, 542, 150, 17, $SS_CENTER)
GUICtrlCreateLabel($Server6Status, 400, 724, 150, 17, $SS_CENTER)
GUICtrlCreateLabel($Server7Status, 400, 786, 150, 17, $SS_CENTER)
GUICtrlCreateLabel($Server8Status, 400, 838, 150, 17, $SS_CENTER)

Need ID variables attached to them example.

$Server1StatusID = GUICtrlCreateLabel($Server1Status, 400, 94, 150, 17, $SS_CENTER)
$Server2StatusID = GUICtrlCreateLabel($Server2Status, 400, 158, 150, 17, $SS_CENTER)

This is so you can update the text with GuiCtrlSetData()

Also you might want to put the stuff that checks the status into a function, so it can be easily called from the loop...

;Server Status Check and Set to Variable
Func _UpdateServerStatus()

    $risasadb = _ServiceStatus("ProfSvc", "172.20.14.162")
    If $risasadb = "Running" Then
        $Server1Status = "Running"
    Else
        $Server1Status = "Not Running"
    EndIf

    $risasapp = _ServiceStatus("ProfSvc", "172.20.14.162")
    If $risasapp = "Running" Then
        $Server2Status = "Running"
    Else
        $Server2Status = "Not Running"
    EndIf

    $risdocdb = _ServiceStatus("ProfSvc", "172.20.14.163")
    If $risdocdb = "Running" Then
        $Server3Status = "Running"
    Else
        $Server3Status = "Not Running"
    EndIf

    $risdocapp = _ServiceStatus("ProfSvc", "172.20.14.163")
    If $risdocapp = "Running" Then
        $Server4Status = "Running"
    Else
        $Server4Status = "Not Running"
    EndIf

    $risdashboard = _ServiceStatus("ProfSvc", "172.20.14.163")
    If $risdashboard = "Running" Then
        $Server5Status = "Running"
    Else
        $Server5Status = "Not Running"
    EndIf

    $pacsproduction = _ServiceStatus("ProfSvc", "172.20.14.163")
    If $pacsproduction = "Running" Then
        $Server6Status = "Running"
    Else
        $Server6Status = "Not Running"
    EndIf

    $pacscont = _ServiceStatus("ProfSvc", "172.20.14.163")
    If $pacscont = "Running" Then
        $Server7Status = "Running"
    Else
        $Server7Status = "Not Running"
    EndIf

    $hhiserver = _ServiceStatus("ProfSvc", "172.20.14.163")
    If $hhiserver = "Running" Then
        $Server8Status = "Running"
    Else
        $Server8Status = "Not Running"
    EndIf

    ;Service Check and Set to Variable

    $RisSqlStatus = _ServiceStatus("MSSQLSERVER", "172.20.14.162")
    If $RisSqlStatus = "Running" Then
        $Server1Label1Status = "Running"
    Else
        $Server1Label1Status = "Not Running"
    EndIf

    $RisSqlAgentStatus = _ServiceStatus("SQLSERVERAGENT", "172.20.14.162")
    If $RisSqlAgentStatus = "Running" Then
        $Server1Label2Status = "Running"
    Else
        $Server1Label2Status = "Not Running"
    EndIf

    $RisAmicasStatus = _ServiceStatus("AmicasVisionSeriesRisServer", "172.20.14.163")
    If $RisAmicasStatus = "Running" Then
        $Server2Label1Status = "Running"
    Else
        $Server2Label1Status = "Not Running"
    EndIf

    $RisBrookTroutStatus = _ServiceStatus("bostservice", "172.20.14.163")
    If $RisBrookTroutStatus = "Running" Then
        $Server2Label2Status = "Running"
    Else
        $Server2Label2Status = "Not Running"
    EndIf

    $RisDocEngineStatus = _ServiceStatus("DocConverterEngine", "172.20.14.163")
    If $RisDocEngineStatus = "Running" Then
        $Server2Label3Status = "Running"
    Else
        $Server2Label3Status = "Not Running"
    EndIf

    $RisFaxStatus = _ServiceStatus("FAXmaker Fax Server", "172.20.14.163")
    If $RisFaxStatus = "Running" Then
        $Server2Label4Status = "Running"
    Else
        $Server2Label4Status = "Not Running"
    EndIf

    $RisFaxAgentStatus = _ServiceStatus("FAXmaker MTA Service", "172.20.14.163")
    If $RisFaxAgentStatus = "Running" Then
        $Server2Label5Status = "Running"
    Else
        $Server2Label5Status = "Not Running"
    EndIf

    $RisFaxWsapiStatus = _ServiceStatus("GFI FaxMaker WSAPI", "172.20.14.163")
    If $RisFaxWsapiStatus = "Running" Then
        $Server2Label6Status = "Running"
    Else
        $Server2Label6Status = "Not Running"
    EndIf

    $RisDocSqlStatus = _ServiceStatus("MSSQL$SCMDOCDB", "172.20.14.164")
    If $RisDocSqlStatus = "Running" Then
        $Server3Label1Status = "Running"
    Else
        $Server3Label1Status = "Not Running"
    EndIf

    $RisDocSqlAgentStatus = _ServiceStatus("SQLAgent$SCMDOCDB", "172.20.14.164")
    If $RisDocSqlAgentStatus = "Running" Then
        $Server3Label2Status = "Running"
    Else
        $Server3Label2Status = "Not Running"
    EndIf

    $RisDocHL7AnalyzerStatus = _ServiceStatus("MDMHL7Analyzer", "172.20.14.165")
    If $RisDocHL7AnalyzerStatus = "Running" Then
        $Server4Label1Status = "Running"
    Else
        $Server4Label1Status = "Not Running"
    EndIf

    $RisDocHL7ProcessorStatus = _ServiceStatus("MDMHL7Processor", "172.20.14.165")
    If $RisDocHL7ProcessorStatus = "Running" Then
        $Server4Label2Status = "Running"
    Else
        $Server4Label2Status = "Not Running"
    EndIf

    $RisDocHL7ReceiverStatus = _ServiceStatus("MDMHL7Receiver", "172.20.14.165")
    If $RisDocHL7ReceiverStatus = "Running" Then
        $Server4Label3Status = "Running"
    Else
        $Server4Label3Status = "Not Running"
    EndIf

    $RisDocHL7JobStatus = _ServiceStatus("MDMJobMonitor", "172.20.14.165")
    If $RisDocHL7JobStatus = "Running" Then
        $Server4Label4Status = "Running"
    Else
        $Server4Label4Status = "Not Running"
    EndIf
    ;
    $RisDashSqlStatus = _ServiceStatus("MSSQLSERVER", "172.20.14.169")
    If $RisDashSqlStatus = "Running" Then
        $Server5Label1Status = "Running"
    Else
        $Server5Label1Status = "Not Running"
    EndIf

    $RisDashSqlAgentStatus = _ServiceStatus("SQLSERVERAGENT", "172.20.14.169")
    If $RisDashSqlAgentStatus = "Running" Then
        $Server5Label2Status = "Running"
    Else
        $Server5Label2Status = "Not Running"
    EndIf

    $RisDashBiStatus = _ServiceStatus("BI ETL", "172.20.14.169")
    If $RisDashBiStatus = "Running" Then
        $Server5Label3Status = "Running"
    Else
        $Server5Label3Status = "Not Running"
    EndIf

    $RisDashIBMStatus = _ServiceStatus("IBM Cognos", "172.20.14.169")
    If $RisDashIBMStatus = "Running" Then
        $Server5Label4Status = "Running"
    Else
        $Server5Label4Status = "Not Running"
    EndIf

EndFunc   ;==>_UpdateServerStatus

You need to also modify the code in it

For example...

$risasadb = _ServiceStatus("ProfSvc", "172.20.14.162")
    If $risasadb = "Running" Then
        $Server1Status = "Running"
    Else
        $Server1Status = "Not Running"
    EndIf
GuiCtrlSetData($Server1StatusID, $Server1Status)

;and so forth

AutoIt Absolute Beginners    Require a serial    Pause Script    Video Tutorials by Morthawt   ipify 

Monkey's are, like, natures humans.

Link to comment
Share on other sites

There may also be better ways to implement code for this but without being familiar with _ServiceStatus function, I have no idea how.

If _ServiceStatus() does not return "Running", then what does it return?

If it is "Not Running" them you have a lot of basically useless bloat in your code.

For example...

$risasadb = _ServiceStatus("ProfSvc", "172.20.14.162")
    If $risasadb = "Running" Then
        $Server1Status = "Running"
    Else
        $Server1Status = "Not Running"
    EndIf
GuiCtrlSetData($Server1StatusID, $Server1Status)

Could become...

$risasadb = _ServiceStatus("ProfSvc", "172.20.14.162")
GuiCtrlSetData($Server1StatusID, $risasadb)

AutoIt Absolute Beginners    Require a serial    Pause Script    Video Tutorials by Morthawt   ipify 

Monkey's are, like, natures humans.

Link to comment
Share on other sites

I made some changes, and now I'm getting a Variable used without being declared at Line 140 ($Server1Status 

I'm not that sharp with coding, I guess I know enough to be dangerous...But I have no idea how to correct this or how to Loop or where to place it..lol...Sorry for being literally helpless here...:-(

#include <GUIConstantsEx.au3>
#include <NTServices.au3>
#include <ButtonConstants.au3>
#include <ComboConstants.au3>
#include <GUIConstantsEx.au3>
#include <StaticConstants.au3>
#include <TabConstants.au3>
#include <WindowsConstants.au3>


#Region ### START Koda GUI section ### Form=c:\users\dmathis\downloads\koda_1.7.3.0\forms\demo.kxf
$Form1_1 = GUICreate("Imaging", 1317, 905, 210, 113)

;Title
$Title = GUICtrlCreateLabel("Imaging Weekly Reboot Maintenance", 7, 11, 1309, 29, $SS_CENTER)
GUICtrlSetFont(-1, 16, 400, 0, "Verdana")

;Headings
$Heading1 = GUICtrlCreateLabel("Server Name", 7, 51, 143, 29)
GUICtrlSetFont(-1, 16, 400, 0, "Verdana")
$Heading2 = GUICtrlCreateLabel("Restart Server", 187, 51, 158, 29)
GUICtrlSetFont(-1, 16, 400, 0, "Verdana")
$Heading3 = GUICtrlCreateLabel("Server Status", 401, 51, 148, 29)
GUICtrlSetFont(-1, 16, 400, 0, "Verdana")
$Heading4 = GUICtrlCreateLabel("Service", 616, 51, 150, 29, $SS_CENTER)
GUICtrlSetFont(-1, 16, 400, 0, "Verdana")
$Heading5 = GUICtrlCreateLabel("Status", 800, 51, 150, 29, $SS_CENTER)
GUICtrlSetFont(-1, 16, 400, 0, "Verdana")
$Heading6 = GUICtrlCreateLabel("Start Service", 976, 51, 150, 27, $SS_CENTER)
GUICtrlSetFont(-1, 14, 400, 0, "Verdana")
$Heading7 = GUICtrlCreateLabel("Stop Service", 1158, 51, 150, 27, $SS_CENTER)
GUICtrlSetFont(-1, 14, 400, 0, "Verdana")

;Servers
$Server1 = GUICtrlCreateLabel("RIS-Asadb", 10, 90, 150, 22, $SS_CENTER)
GUICtrlSetFont(-1, 12, 400, 0, "Verdana")
$Server2 = GUICtrlCreateLabel("RIS-Asapp", 10, 154, 150, 22, $SS_CENTER)
GUICtrlSetFont(-1, 12, 400, 0, "Verdana")
$Server3 = GUICtrlCreateLabel("RIS-Docdb", 10, 346, 150, 22, $SS_CENTER)
GUICtrlSetFont(-1, 12, 400, 0, "Verdana")
$Server4 = GUICtrlCreateLabel("RIS-Docapp", 10, 410, 150, 22, $SS_CENTER)
GUICtrlSetFont(-1, 12, 400, 0, "Verdana")
$Server5 = GUICtrlCreateLabel("RIS-Dashboards", 10, 538, 150, 22, $SS_CENTER)
GUICtrlSetFont(-1, 12, 400, 0, "Verdana")
$Server6 = GUICtrlCreateLabel("Pacs-Production", 10, 723, 150, 22, $SS_CENTER)
GUICtrlSetFont(-1, 12, 400, 0, "Verdana")
$Server7 = GUICtrlCreateLabel("Pacs-Cont", 10, 785, 150, 22, $SS_CENTER)
GUICtrlSetFont(-1, 12, 400, 0, "Verdana")
$Server8 = GUICtrlCreateLabel("HHIServer", 10, 837, 150, 22, $SS_CENTER)
GUICtrlSetFont(-1, 12, 400, 0, "Verdana")


;Server Status Check and Set to Variable

Func _UpdateServerStatus()
   
$risasadb = _ServiceStatus("ProfSvc", "172.20.14.162")
GUICtrlSetData($Server1StatusID, $Server1Status)

$risasapp = _ServiceStatus("ProfSvc", "172.20.14.162")
GuiCtrlSetData($Server2StatusID, $Server2Status)

$risdocdb = _ServiceStatus("ProfSvc", "172.20.14.163")
GuiCtrlSetData($Server3StatusID, $Server3Status)

$risdocapp = _ServiceStatus("ProfSvc", "172.20.14.163")
GuiCtrlSetData($Server4StatusID, $Server4Status)

$risdashboard = _ServiceStatus("ProfSvc", "172.20.14.163")
GuiCtrlSetData($Server5StatusID, $Server5Status)

$pacsproduction = _ServiceStatus("ProfSvc", "172.20.14.163")
GuiCtrlSetData($Server6StatusID, $Server6Status)

$pacscont = _ServiceStatus("ProfSvc", "172.20.14.163")
GuiCtrlSetData($Server7StatusID, $Server7Status)

$hhiserver = _ServiceStatus("ProfSvc", "172.20.14.163")
GuiCtrlSetData($Server8StatusID, $Server8Status)

;Service Check and Set to Variable

$RisSqlStatus = _ServiceStatus("MSSQLSERVER", "172.20.14.162")
GUICtrlSetData($Server1Label1StatusID, $Server1Label1Status)

$RisSqlAgentStatus = _ServiceStatus("SQLSERVERAGENT", "172.20.14.162")
GUICtrlSetData($Server1Label2StatusID, $Server1Label2Status)

$RisAmicasStatus = _ServiceStatus("AmicasVisionSeriesRisServer", "172.20.14.163")
GUICtrlSetData($Server2Label1StatusID, $Server2Label1Status)

$RisBrookTroutStatus = _ServiceStatus("bostservice", "172.20.14.163")
GUICtrlSetData($Server2Label2StatusID, $Server2Label2Status)

$RisDocEngineStatus = _ServiceStatus("DocConverterEngine", "172.20.14.163")
GUICtrlSetData($Server2Label3StatusID, $Server2Label3Status)

$RisFaxStatus = _ServiceStatus("FAXmaker Fax Server", "172.20.14.163")
GUICtrlSetData($Server2Label4StatusID, $Server2Label4Status)

$RisFaxAgentStatus = _ServiceStatus("FAXmaker MTA Service", "172.20.14.163")
GUICtrlSetData($Server2Label5StatusID, $Server2Label5Status)

$RisFaxWsapiStatus = _ServiceStatus("GFI FaxMaker WSAPI", "172.20.14.163")
GUICtrlSetData($Server2Label6StatusID, $Server2Label6Status)

$RisDocSqlStatus = _ServiceStatus("MSSQL$SCMDOCDB", "172.20.14.164")
GUICtrlSetData($Server3Label1StatusID, $Server3Label1Status)

$RisDocSqlAgentStatus = _ServiceStatus("SQLAgent$SCMDOCDB", "172.20.14.164")
GUICtrlSetData($Server3Label2StatusID, $Server3Label2Status)

$RisDocHL7AnalyzerStatus = _ServiceStatus("MDMHL7Analyzer", "172.20.14.165")
GUICtrlSetData($Server4Label1StatusID, $Server4Label1Status)

$RisDocHL7ProcessorStatus = _ServiceStatus("MDMHL7Processor", "172.20.14.165")
GUICtrlSetData($Server4Label2StatusID, $Server4Label2Status)

$RisDocHL7ReceiverStatus = _ServiceStatus("MDMHL7Receiver", "172.20.14.165")
GUICtrlSetData($Server4Label3StatusID, $Server4Label3Status)

$RisDocHL7JobStatus = _ServiceStatus("MDMJobMonitor", "172.20.14.165")
GUICtrlSetData($Server4Label4StatusID, $Server4Label4Status)

$RisDashSqlStatus = _ServiceStatus("MSSQLSERVER", "172.20.14.169")
GUICtrlSetData($Server5Label1StatusID, $Server5Label1Status)

$RisDashSqlAgentStatus = _ServiceStatus("SQLSERVERAGENT", "172.20.14.169")
GUICtrlSetData($Server5Label2StatusID, $Server5Label2Status)

$RisDashBiStatus = _ServiceStatus("BI ETL", "172.20.14.169")
GUICtrlSetData($Server5Label3StatusID, $Server5Label3Status)

$RisDashIBMStatus = _ServiceStatus("IBM Cognos", "172.20.14.169")
GUICtrlSetData($Server5Label4StatusID, $Server5Label4Status)

EndFunc

;Server Status
$Server1StatusID = GUICtrlCreateLabel($Server1Status, 400, 94, 150, 17, $SS_CENTER)
$Server2StatusID = GUICtrlCreateLabel($Server2Status, 400, 158, 150, 17, $SS_CENTER)
$Server3StatusID = GUICtrlCreateLabel($Server3Status, 400, 350, 150, 17, $SS_CENTER)
$Server4StatusID = GUICtrlCreateLabel($Server4Status, 400, 414, 150, 17, $SS_CENTER)
$Server5StatusID = GUICtrlCreateLabel($Server5Status, 400, 542, 150, 17, $SS_CENTER)
$Server6StatusID = GUICtrlCreateLabel($Server6Status, 400, 724, 150, 17, $SS_CENTER)
$Server7StatusID = GUICtrlCreateLabel($Server7Status, 400, 786, 150, 17, $SS_CENTER)
$Server8StatusID = GUICtrlCreateLabel($Server8Status, 400, 838, 150, 17, $SS_CENTER)


;Server1 Service Name and Status
GUICtrlCreateLabel("SQL", 616, 94, 150, 17, $SS_CENTER)
$Server1Label1StatusID = GUICtrlCreateLabel($Server1Label1Status, 800, 94, 150, 17, $SS_CENTER)
GUICtrlCreateLabel("SQL Agent", 616, 126, 150, 17, $SS_CENTER)
$Server1Label2StatusID = GUICtrlCreateLabel($Server1Label2Status, 800, 126, 150, 17, $SS_CENTER)

;Server2 Service Name and Status
GUICtrlCreateLabel("AMICAS VSRIS", 616, 158, 150, 17, $SS_CENTER)
$Server2Label1StatusID = GUICtrlCreateLabel($Server2Label1Status, 800, 158, 150, 17, $SS_CENTER)
GUICtrlCreateLabel("Brooktrout Boston Host", 616, 190, 150, 17, $SS_CENTER)
$Server2Label2StatusID = GUICtrlCreateLabel($Server2Label2Status, 800, 190, 150, 17, $SS_CENTER)
GUICtrlCreateLabel("DocConverter MRIS", 616, 222, 150, 17, $SS_CENTER)
$Server2Label3StatusID = GUICtrlCreateLabel($Server2Label3Status, 800, 222, 150, 17, $SS_CENTER)
GUICtrlCreateLabel("GFI FaxMaker Server", 616, 254, 150, 17, $SS_CENTER)
$Server2Label4StatusID = GUICtrlCreateLabel($Server2Label4Status, 800, 254, 150, 17, $SS_CENTER)
GUICtrlCreateLabel("GFI Message Transfer Agent", 616, 286, 150, 17, $SS_CENTER)
$Server2Label5StatusID = GUICtrlCreateLabel($Server2Label5Status, 800, 286, 150, 17, $SS_CENTER)
GUICtrlCreateLabel("WSAPI", 616, 318, 150, 17, $SS_CENTER)
$Server2Label6StatusID = GUICtrlCreateLabel($Server2Label6Status, 800, 318, 150, 17, $SS_CENTER)

;Server3 Service Name and Status
GUICtrlCreateLabel("SQL", 616, 350, 150, 17, $SS_CENTER)
$Server3Label1StatusID = GUICtrlCreateLabel($Server3Label1Status, 800, 350, 150, 17, $SS_CENTER)
GUICtrlCreateLabel("SQL Agent", 616, 380, 150, 17, $SS_CENTER)
$Server3Label2StatusID = GUICtrlCreateLabel($Server3Label2Status, 800, 382, 150, 17, $SS_CENTER)

;Server4 Service Name and Status
GUICtrlCreateLabel("HL7 Analyzer", 616, 414, 150, 17, $SS_CENTER)
$Server4Label1StatusID = GUICtrlCreateLabel($Server4Label1Status, 800, 414, 150, 17, $SS_CENTER)
GUICtrlCreateLabel("HL7 Processor", 616, 446, 150, 17, $SS_CENTER)
$Server4Label2StatusID = GUICtrlCreateLabel($Server4Label2Status, 800, 446, 150, 17, $SS_CENTER)
GUICtrlCreateLabel("HL7 Receiver", 616, 478, 150, 17, $SS_CENTER)
$Server4Label3StatusID = GUICtrlCreateLabel($Server4Label3Status, 800, 478, 150, 17, $SS_CENTER)
GUICtrlCreateLabel("HL7 Job Monitor", 616, 510, 150, 17, $SS_CENTER)
$Server4Label4StatusID = GUICtrlCreateLabel($Server4Label4Status, 800, 510, 150, 17, $SS_CENTER)

;Server5 Service Name and Status
GUICtrlCreateLabel("SQL", 616, 542, 150, 17, $SS_CENTER)
$Server5Label1StatusID = GUICtrlCreateLabel($Server5Label1Status, 800, 542, 150, 17, $SS_CENTER)
GUICtrlCreateLabel("SQL Agent", 616, 574, 150, 17, $SS_CENTER)
$Server5Label2StatusID = GUICtrlCreateLabel($Server5Label2Status, 800, 574, 150, 17, $SS_CENTER)
GUICtrlCreateLabel("BI ETL", 616, 606, 150, 17, $SS_CENTER)
$Server5Label3StatusID = GUICtrlCreateLabel($Server5Label3Status, 800, 606, 150, 17, $SS_CENTER)
GUICtrlCreateLabel("IBM Cognos", 616, 638, 150, 17, $SS_CENTER)
$Server5Label4StatusID = GUICtrlCreateLabel($Server5Label4Status, 800, 638, 150, 17, $SS_CENTER)

;Service Start Buttons
$Button60 = GUICtrlCreateButton("Start", 1006, 88, 81, 25)
$Button61 = GUICtrlCreateButton("Start", 1006, 120, 81, 25)
$Button62 = GUICtrlCreateButton("Start", 1006, 152, 81, 25)
$Button63 = GUICtrlCreateButton("Start", 1006, 184, 81, 25)
$Button64 = GUICtrlCreateButton("Start", 1006, 216, 81, 25)
$Button65 = GUICtrlCreateButton("Start", 1006, 248, 81, 25)
$Button66 = GUICtrlCreateButton("Start", 1006, 280, 81, 25)
$Button67 = GUICtrlCreateButton("Start", 1006, 312, 81, 25)
$Button68 = GUICtrlCreateButton("Start", 1006, 344, 81, 25)
$Button69 = GUICtrlCreateButton("Start", 1006, 376, 81, 25)
$Button70 = GUICtrlCreateButton("Start", 1006, 408, 81, 25)
$Button71 = GUICtrlCreateButton("Start", 1006, 440, 81, 25)
$Button72 = GUICtrlCreateButton("Start", 1006, 472, 81, 25)
$Button73 = GUICtrlCreateButton("Start", 1006, 504, 81, 25)
$Button74 = GUICtrlCreateButton("Start", 1006, 536, 81, 25)
$Button75 = GUICtrlCreateButton("Start", 1006, 568, 81, 25)
$Button76 = GUICtrlCreateButton("Start", 1006, 600, 81, 25)
$Button77 = GUICtrlCreateButton("Start", 1006, 632, 81, 25)

;Service Stop Buttons
$Button80 = GUICtrlCreateButton("Stop", 1190, 88, 81, 25)
$Button81 = GUICtrlCreateButton("Stop", 1190, 120, 81, 25)
$Button82 = GUICtrlCreateButton("Stop", 1190, 152, 81, 25)
$Button83 = GUICtrlCreateButton("Stop", 1190, 184, 81, 25)
$Button84 = GUICtrlCreateButton("Stop", 1190, 216, 81, 25)
$Button85 = GUICtrlCreateButton("Stop", 1190, 248, 81, 25)
$Button86 = GUICtrlCreateButton("Stop", 1190, 280, 81, 25)
$Button87 = GUICtrlCreateButton("Stop", 1190, 312, 81, 25)
$Button88 = GUICtrlCreateButton("Stop", 1190, 344, 81, 25)
$Button89 = GUICtrlCreateButton("Stop", 1190, 376, 81, 25)
$Button90 = GUICtrlCreateButton("Stop", 1190, 408, 81, 25)
$Button91 = GUICtrlCreateButton("Stop", 1190, 440, 81, 25)
$Button92 = GUICtrlCreateButton("Stop", 1190, 472, 81, 25)
$Button93 = GUICtrlCreateButton("Stop", 1190, 504, 81, 25)
$Button94 = GUICtrlCreateButton("Stop", 1190, 536, 81, 25)
$Button95 = GUICtrlCreateButton("Stop", 1190, 568, 81, 25)
$Button96 = GUICtrlCreateButton("Stop", 1190, 600, 81, 25)
$Button97 = GUICtrlCreateButton("Stop", 1190, 632, 81, 25)

; Server Restart Buttons
$Server1Restart = GUICtrlCreateButton("Restart", 223, 88, 81, 25)
$Server2Restart = GUICtrlCreateButton("Restart", 223, 152, 81, 25)
$Server3Restart = GUICtrlCreateButton("Restart", 223, 344, 81, 25)
$Server4Restart = GUICtrlCreateButton("Restart", 223, 408, 81, 25)
$Server5Restart = GUICtrlCreateButton("Restart", 223, 536, 81, 25)
$Server6Restart = GUICtrlCreateButton("Restart", 223, 721, 81, 25)
$Server7Restart = GUICtrlCreateButton("Restart", 223, 783, 81, 25)
$Server8Restart = GUICtrlCreateButton("Restart", 223, 835, 81, 25)



GUISetState(@SW_SHOW)
#EndRegion ### END Koda GUI section ###

While 1
    $nMsg = GUIGetMsg()
    Switch $nMsg
        Case $GUI_EVENT_CLOSE
            Exit
         
         Case $Server1Restart
            RestartServer1()
         
         Case $Server2Restart
            RestartServer2()
         
         Case $Server3Restart
            RestartServer3()
         
         Case $Server4Restart
            RestartServer4()
         
         Case $Server5Restart
            RestartServer5()
         
         Case $Server6Restart
            RestartServer6()
         
         Case $Server7Restart
            RestartServer7()
         
         Case $Server8Restart
            RestartServer8()
         
         Case $Button60
            Server1Service1Start()
         
         Case $Button61
            Server1Service2Start()
         
         Case $Button62
            Server2Service1Start()
         
         Case $Button63
            Server2Service2Start()
         
         Case $Button64
            Server2Service3Start()
         
         Case $Button65
            Server2Service4Start()
         
         Case $Button66
            Server2Service5Start()
         
         Case $Button67
            Server2Service6Start()
         
         Case $Button68
            Server3Service1Start()
         
         Case $Button69
            Server3Service2Start()
         
         Case $Button70
            Server4Service1Start()
         
         Case $Button71
            Server4Service2Start()
         
         Case $Button72
            Server4Service3Start()
         
         Case $Button73
            Server4Service4Start()
         
         Case $Button74
            Server5Service1Start()
         
         Case $Button75
            Server5Service2Start()
         
         Case $Button76
            Server5Service3Start()
         
         Case $Button77
            Server5Service4Start()
            
         Case $Button80
            Server1Service1Stop()
         
         Case $Button81
            Server1Service2Stop()
         
         Case $Button82
            Server2Service1Stop()
         
         Case $Button83
            Server2Service2Stop()
         
         Case $Button84
            Server2Service3Stop()
         
         Case $Button85
            Server2Service4Stop()
         
         Case $Button86
            Server2Service5Stop()
         
         Case $Button87
            Server2Service6Stop()
         
         Case $Button88
            Server3Service1Stop()
         
         Case $Button89
            Server3Service2Stop()
         
         Case $Button90
            Server4Service1Stop()
         
         Case $Button91
            Server4Service2Stop()
         
         Case $Button92
            Server4Service3Stop()
         
         Case $Button93
            Server4Service4Stop()
         
         Case $Button94
            Server5Service1Stop()
         
         Case $Button95
            Server5Service2Stop()
         
         Case $Button96
            Server5Service3Stop()
         
         Case $Button97
            Server5Service4Stop()
            
    EndSwitch
WEnd

;Restart Functions
Func RestartServer1()
   run("shutdown.exe -m \\172.20.14.162 -f -r")
EndFunc
Func RestartServer2()
   run("shutdown.exe -m \\172.20.14.163 -f -r")
EndFunc
Func RestartServer3()
   run("shutdown.exe -m \\172.20.14.164 -f -r")
EndFunc
Func RestartServer4()
   run("shutdown.exe -m \\172.20.14.165 -f -r")
EndFunc
Func RestartServer5()
   run("shutdown.exe -m \\172.20.14.169 -f -r")
EndFunc
Func RestartServer6()
   run("shutdown.exe -m \\pacs-production -f -r")
EndFunc
Func RestartServer7()
   run("shutdown.exe -m \\172.20.14.159 -f -r")
EndFunc
Func RestartServer8()
   run("shutdown.exe -m \\192.168.21.5 -f -r")
EndFunc

;Service Start Functions
Func Server1Service1Start()
   Run('sc \\172.20.14.162 start "MSSQLSERVER"', '', @SW_HIDE, 2)
EndFunc
Func Server1Service2Start()
   Run('sc \\172.20.14.162 start "SQLSERVERAGENT"', '', @SW_HIDE, 2)
EndFunc
Func Server2Service1Start()
   Run('sc \\172.20.14.163 start "AmicasVisionSeriesRisServer"', '', @SW_HIDE, 2)
EndFunc
Func Server2Service2Start()
   Run('sc \\172.20.14.163 start "bostservice"', '', @SW_HIDE, 2)
EndFunc
Func Server2Service3Start()
   Run('sc \\172.20.14.163 start "DocConverterEngine"', '', @SW_HIDE, 2)
EndFunc
Func Server2Service4Start()
   Run('sc \\172.20.14.163 start "FAXmaker Fax Server"', '', @SW_HIDE, 2)
EndFunc
Func Server2Service5Start()
   Run('sc \\172.20.14.163 start "FAXmaker MTA Service"', '', @SW_HIDE, 2)
EndFunc
Func Server2Service6Start()
   Run('sc \\172.20.14.163 start "GFI FaxMaker WSAPI"', '', @SW_HIDE, 2)
EndFunc
Func Server3Service1Start()
   Run('sc \\172.20.14.164 start "MSSQL$SCMDOCDB"', '', @SW_HIDE, 2)
EndFunc
Func Server3Service2Start()
   Run('sc \\172.20.14.164 start "SQLAgent$SCMDOCDB"', '', @SW_HIDE, 2)
EndFunc
Func Server4Service1Start()
   Run('sc \\172.20.14.165 start "MDMHL7Analyzer"', '', @SW_HIDE, 2)
EndFunc
Func Server4Service2Start()
   Run('sc \\172.20.14.165 start "MDMHL7Processor"', '', @SW_HIDE, 2)
EndFunc
Func Server4Service3Start()
   Run('sc \\172.20.14.165 start "MDMHL7Receiver"', '', @SW_HIDE, 2)
EndFunc
Func Server4Service4Start()
   Run('sc \\172.20.14.165 start "MDMJobMonitor"', '', @SW_HIDE, 2)
EndFunc
Func Server5Service1Start()
   Run('sc \\172.20.14.169 start "MSSQLSERVER"', '', @SW_HIDE, 2)
EndFunc
Func Server5Service2Start()
   Run('sc \\172.20.14.169 start "SQLSERVERAGENT"', '', @SW_HIDE, 2)
EndFunc
Func Server5Service3Start()
   Run('sc \\172.20.14.169 start "BI ETL"', '', @SW_HIDE, 2)
EndFunc
Func Server5Service4Start()
   Run('sc \\172.20.14.169 start "IBM Cognos"', '', @SW_HIDE, 2)
EndFunc

;Service Stop Functions
Func Server1Service1Stop()
   Run('sc \\172.20.14.162 stop "MSSQLSERVER"', '', @SW_HIDE, 2)
EndFunc
Func Server1Service2Stop()
   Run('sc \\172.20.14.162 stop "SQLSERVERAGENT"', '', @SW_HIDE, 2)
EndFunc
Func Server2Service1Stop()
   Run('sc \\172.20.14.163 stop "AmicasVisionSeriesRisServer"', '', @SW_HIDE, 2)
EndFunc
Func Server2Service2Stop()
   Run('sc \\172.20.14.163 stop "bostservice"', '', @SW_HIDE, 2)
EndFunc
Func Server2Service3Stop()
   Run('sc \\172.20.14.163 stop "DocConverterEngine"', '', @SW_HIDE, 2)
EndFunc
Func Server2Service4Stop()
   Run('sc \\172.20.14.163 stop "FAXmaker Fax Server"', '', @SW_HIDE, 2)
EndFunc
Func Server2Service5Stop()
   Run('sc \\172.20.14.163 stop "FAXmaker MTA Service"', '', @SW_HIDE, 2)
EndFunc
Func Server2Service6Stop()
   Run('sc \\172.20.14.163 stop "GFI FaxMaker WSAPI"', '', @SW_HIDE, 2)
EndFunc
Func Server3Service1Stop()
   Run('sc \\172.20.14.164 stop "MSSQL$SCMDOCDB"', '', @SW_HIDE, 2)
EndFunc
Func Server3Service2Stop()
   Run('sc \\172.20.14.164 stop "SQLAgent$SCMDOCDB"', '', @SW_HIDE, 2)
EndFunc
Func Server4Service1Stop()
   Run('sc \\172.20.14.165 stop "MDMHL7Analyzer"', '', @SW_HIDE, 2)
EndFunc
Func Server4Service2Stop()
   Run('sc \\172.20.14.165 stop "MDMHL7Processor"', '', @SW_HIDE, 2)
EndFunc
Func Server4Service3Stop()
   Run('sc \\172.20.14.165 stop "MDMHL7Receiver"', '', @SW_HIDE, 2)
EndFunc
Func Server4Service4Stop()
   Run('sc \\172.20.14.165 stop "MDMJobMonitor"', '', @SW_HIDE, 2)
EndFunc
Func Server5Service1Stop()
   Run('sc \\172.20.14.169 stop "MSSQLSERVER"', '', @SW_HIDE, 2)
EndFunc
Func Server5Service2Stop()
   Run('sc \\172.20.14.169 stop "SQLSERVERAGENT"', '', @SW_HIDE, 2)
EndFunc
Func Server5Service3Stop()
   Run('sc \\172.20.14.169 stop "BI ETL"', '', @SW_HIDE, 2)
EndFunc
Func Server5Service4Stop()
   Run('sc \\172.20.14.169 stop "IBM Cognos"', '', @SW_HIDE, 2)
EndFunc
Edited by DanielMathis
Link to comment
Share on other sites

In _UpdateServerStatus function GuiCtrlSetData needs to use data returned from the function above it, like so...

$risasadb = _ServiceStatus("ProfSvc", "172.20.14.162")
GUICtrlSetData($Server1StatusID, $risasadb)

$risasapp = _ServiceStatus("ProfSvc", "172.20.14.162")
GUICtrlSetData($Server2StatusID, $risasapp)

$risdocdb = _ServiceStatus("ProfSvc", "172.20.14.163")
GUICtrlSetData($Server3StatusID, $risdocdb)

$risdocapp = _ServiceStatus("ProfSvc", "172.20.14.163")
GUICtrlSetData($Server4StatusID, $risdocapp)

Also, remember these...

$Server1StatusID = GUICtrlCreateLabel($Server1Status, 400, 94, 150, 17, $SS_CENTER)
$Server2StatusID = GUICtrlCreateLabel($Server2Status, 400, 158, 150, 17, $SS_CENTER)
$Server3StatusID = GUICtrlCreateLabel($Server3Status, 400, 350, 150, 17, $SS_CENTER)
$Server4StatusID = GUICtrlCreateLabel($Server4Status, 400, 414, 150, 17, $SS_CENTER)
$Server5StatusID = GUICtrlCreateLabel($Server5Status, 400, 542, 150, 17, $SS_CENTER)
$Server6StatusID = GUICtrlCreateLabel($Server6Status, 400, 724, 150, 17, $SS_CENTER)
$Server7StatusID = GUICtrlCreateLabel($Server7Status, 400, 786, 150, 17, $SS_CENTER)
$Server8StatusID = GUICtrlCreateLabel($Server8Status, 400, 838, 150, 17, $SS_CENTER)

Well $Server1Status, $Server2Status, $Server3Status etc.. do not mean anything any more as they are not declared.

So initially, you should just initiate them to "Pending check"  or something similar, until the _UpdateServerStatus() func is called.

AutoIt Absolute Beginners    Require a serial    Pause Script    Video Tutorials by Morthawt   ipify 

Monkey's are, like, natures humans.

Link to comment
Share on other sites

Or ...

$InitalStatus = "Pending"

$Server1StatusID = GUICtrlCreateLabel($InitalStatus, 400, 94, 150, 17, $SS_CENTER)
$Server2StatusID = GUICtrlCreateLabel($InitalStatus, 400, 158, 150, 17, $SS_CENTER)
$Server3StatusID = GUICtrlCreateLabel($InitalStatus, 400, 350, 150, 17, $SS_CENTER)
; etc...

AutoIt Absolute Beginners    Require a serial    Pause Script    Video Tutorials by Morthawt   ipify 

Monkey's are, like, natures humans.

Link to comment
Share on other sites

OK! I think I understand the GUICTRLSETDATA now.....you're running the query with the $risasadb = _ServiceStatus("ProfSvc", "172.20.14.162")

and then on the next line, GUICtrlSetData comes along and says for whereever $Server1StatusID is in the code, append the data with this result from $risasadb

 

I think that's how I'm understanding it...lol

 

So next question is, Does the Func _UpdateServerStatus() need to be at the top of the code where I have it now or down at the bottom with the rest of the Func's and where does it get placed for the loop to work?

lol...questions questions and more questions....Atleast, I'm not getting a error anywhere....thats a plus...

#include <GUIConstantsEx.au3>
#include <NTServices.au3>
#include <ButtonConstants.au3>
#include <ComboConstants.au3>
#include <GUIConstantsEx.au3>
#include <StaticConstants.au3>
#include <TabConstants.au3>
#include <WindowsConstants.au3>


#Region ### START Koda GUI section ### Form=c:\users\dmathis\downloads\koda_1.7.3.0\forms\demo.kxf
$Form1_1 = GUICreate("Imaging", 1317, 905, 210, 113)


$InitalServerStatus = "Check Pending"
$InitalServiceStatus = "Check Pending"


;Title
GUICtrlCreateLabel("Imaging Weekly Reboot Maintenance", 7, 11, 1309, 29, $SS_CENTER)
GUICtrlSetFont(-1, 16, 400, 0, "Verdana")

;Headings
GUICtrlCreateLabel("Server Name", 7, 51, 143, 29)
GUICtrlSetFont(-1, 16, 400, 0, "Verdana")
GUICtrlCreateLabel("Restart Server", 187, 51, 158, 29)
GUICtrlSetFont(-1, 16, 400, 0, "Verdana")
GUICtrlCreateLabel("Server Status", 401, 51, 148, 29)
GUICtrlSetFont(-1, 16, 400, 0, "Verdana")
GUICtrlCreateLabel("Service", 616, 51, 150, 29, $SS_CENTER)
GUICtrlSetFont(-1, 16, 400, 0, "Verdana")
GUICtrlCreateLabel("Status", 800, 51, 150, 29, $SS_CENTER)
GUICtrlSetFont(-1, 16, 400, 0, "Verdana")
GUICtrlCreateLabel("Start Service", 976, 51, 150, 27, $SS_CENTER)
GUICtrlSetFont(-1, 14, 400, 0, "Verdana")
GUICtrlCreateLabel("Stop Service", 1158, 51, 150, 27, $SS_CENTER)
GUICtrlSetFont(-1, 14, 400, 0, "Verdana")

;Servers
GUICtrlCreateLabel("RIS-Asadb", 10, 90, 150, 22, $SS_CENTER)
GUICtrlSetFont(-1, 12, 400, 0, "Verdana")
GUICtrlCreateLabel("RIS-Asapp", 10, 154, 150, 22, $SS_CENTER)
GUICtrlSetFont(-1, 12, 400, 0, "Verdana")
GUICtrlCreateLabel("RIS-Docdb", 10, 346, 150, 22, $SS_CENTER)
GUICtrlSetFont(-1, 12, 400, 0, "Verdana")
GUICtrlCreateLabel("RIS-Docapp", 10, 410, 150, 22, $SS_CENTER)
GUICtrlSetFont(-1, 12, 400, 0, "Verdana")
GUICtrlCreateLabel("RIS-Dashboards", 10, 538, 150, 22, $SS_CENTER)
GUICtrlSetFont(-1, 12, 400, 0, "Verdana")
GUICtrlCreateLabel("Pacs-Production", 10, 723, 150, 22, $SS_CENTER)
GUICtrlSetFont(-1, 12, 400, 0, "Verdana")
GUICtrlCreateLabel("Pacs-Cont", 10, 785, 150, 22, $SS_CENTER)
GUICtrlSetFont(-1, 12, 400, 0, "Verdana")
GUICtrlCreateLabel("HHIServer", 10, 837, 150, 22, $SS_CENTER)
GUICtrlSetFont(-1, 12, 400, 0, "Verdana")


;Server Status Check and Set to Variable

Func _UpdateServerStatus()
$risasadb = _ServiceStatus("ProfSvc", "172.20.14.162")
GUICtrlSetData($Server1StatusID, $risasadb)

$risasapp = _ServiceStatus("ProfSvc", "172.20.14.162")
GuiCtrlSetData($Server2StatusID, $risasapp)

$risdocdb = _ServiceStatus("ProfSvc", "172.20.14.163")
GuiCtrlSetData($Server3StatusID, $risdocdb)

$risdocapp = _ServiceStatus("ProfSvc", "172.20.14.163")
GuiCtrlSetData($Server4StatusID, $risdocapp)

$risdashboard = _ServiceStatus("ProfSvc", "172.20.14.163")
GuiCtrlSetData($Server5StatusID, $risdashboard)

$pacsproduction = _ServiceStatus("ProfSvc", "172.20.14.163")
GuiCtrlSetData($Server6StatusID, $pacsproduction)

$pacscont = _ServiceStatus("ProfSvc", "172.20.14.163")
GuiCtrlSetData($Server7StatusID, $pacscont)

$hhiserver = _ServiceStatus("ProfSvc", "172.20.14.163")
GuiCtrlSetData($Server8StatusID, $hhiserver)

;Service Check and Set to Variable

$RisSqlStatus = _ServiceStatus("MSSQLSERVER", "172.20.14.162")
GUICtrlSetData($Server1Label1StatusID, $RisSqlStatus)

$RisSqlAgentStatus = _ServiceStatus("SQLSERVERAGENT", "172.20.14.162")
GUICtrlSetData($Server1Label2StatusID, $RisSqlAgentStatus)

$RisAmicasStatus = _ServiceStatus("AmicasVisionSeriesRisServer", "172.20.14.163")
GUICtrlSetData($Server2Label1StatusID, $RisAmicasStatus)

$RisBrookTroutStatus = _ServiceStatus("bostservice", "172.20.14.163")
GUICtrlSetData($Server2Label2StatusID, $RisBrookTroutStatus)

$RisDocEngineStatus = _ServiceStatus("DocConverterEngine", "172.20.14.163")
GUICtrlSetData($Server2Label3StatusID, $RisDocEngineStatus)

$RisFaxStatus = _ServiceStatus("FAXmaker Fax Server", "172.20.14.163")
GUICtrlSetData($Server2Label4StatusID, $RisFaxStatus)

$RisFaxAgentStatus = _ServiceStatus("FAXmaker MTA Service", "172.20.14.163")
GUICtrlSetData($Server2Label5StatusID, $RisFaxAgentStatus)

$RisFaxWsapiStatus = _ServiceStatus("GFI FaxMaker WSAPI", "172.20.14.163")
GUICtrlSetData($Server2Label6StatusID, $RisFaxWsapiStatus)

$RisDocSqlStatus = _ServiceStatus("MSSQL$SCMDOCDB", "172.20.14.164")
GUICtrlSetData($Server3Label1StatusID, $RisDocSqlStatus)

$RisDocSqlAgentStatus = _ServiceStatus("SQLAgent$SCMDOCDB", "172.20.14.164")
GUICtrlSetData($Server3Label2StatusID, $RisDocSqlAgentStatus)

$RisDocHL7AnalyzerStatus = _ServiceStatus("MDMHL7Analyzer", "172.20.14.165")
GUICtrlSetData($Server4Label1StatusID, $RisDocHL7AnalyzerStatus)

$RisDocHL7ProcessorStatus = _ServiceStatus("MDMHL7Processor", "172.20.14.165")
GUICtrlSetData($Server4Label2StatusID, $RisDocHL7ProcessorStatus)

$RisDocHL7ReceiverStatus = _ServiceStatus("MDMHL7Receiver", "172.20.14.165")
GUICtrlSetData($Server4Label3StatusID, $RisDocHL7ReceiverStatus)

$RisDocHL7JobStatus = _ServiceStatus("MDMJobMonitor", "172.20.14.165")
GUICtrlSetData($Server4Label4StatusID, $RisDocHL7JobStatus)

$RisDashSqlStatus = _ServiceStatus("MSSQLSERVER", "172.20.14.169")
GUICtrlSetData($Server5Label1StatusID, $RisDashSqlStatus)

$RisDashSqlAgentStatus = _ServiceStatus("SQLSERVERAGENT", "172.20.14.169")
GUICtrlSetData($Server5Label2StatusID, $RisDashSqlAgentStatus)

$RisDashBiStatus = _ServiceStatus("BI ETL", "172.20.14.169")
GUICtrlSetData($Server5Label3StatusID, $RisDashBiStatus)

$RisDashIBMStatus = _ServiceStatus("IBM Cognos", "172.20.14.169")
GUICtrlSetData($Server5Label4StatusID, $RisDashIBMStatus)

EndFunc


;Server Status
$Server1StatusID = GUICtrlCreateLabel($InitalServerStatus, 400, 94, 150, 17, $SS_CENTER)
$Server2StatusID = GUICtrlCreateLabel($InitalServerStatus, 400, 158, 150, 17, $SS_CENTER)
$Server3StatusID = GUICtrlCreateLabel($InitalServerStatus, 400, 350, 150, 17, $SS_CENTER)
$Server4StatusID = GUICtrlCreateLabel($InitalServerStatus, 400, 414, 150, 17, $SS_CENTER)
$Server5StatusID = GUICtrlCreateLabel($InitalServerStatus, 400, 542, 150, 17, $SS_CENTER)
$Server6StatusID = GUICtrlCreateLabel($InitalServerStatus, 400, 724, 150, 17, $SS_CENTER)
$Server7StatusID = GUICtrlCreateLabel($InitalServerStatus, 400, 786, 150, 17, $SS_CENTER)
$Server8StatusID = GUICtrlCreateLabel($InitalServerStatus, 400, 838, 150, 17, $SS_CENTER)


;Server1 Service Name and Status
GUICtrlCreateLabel("SQL", 616, 94, 150, 17, $SS_CENTER)
$Server1Label1StatusID = GUICtrlCreateLabel($InitalServiceStatus, 800, 94, 150, 17, $SS_CENTER)
GUICtrlCreateLabel("SQL Agent", 616, 126, 150, 17, $SS_CENTER)
$Server1Label2StatusID = GUICtrlCreateLabel($InitalServiceStatus, 800, 126, 150, 17, $SS_CENTER)

;Server2 Service Name and Status
GUICtrlCreateLabel("AMICAS VSRIS", 616, 158, 150, 17, $SS_CENTER)
$Server2Label1StatusID = GUICtrlCreateLabel($InitalServiceStatus, 800, 158, 150, 17, $SS_CENTER)
GUICtrlCreateLabel("Brooktrout Boston Host", 616, 190, 150, 17, $SS_CENTER)
$Server2Label2StatusID = GUICtrlCreateLabel($InitalServiceStatus, 800, 190, 150, 17, $SS_CENTER)
GUICtrlCreateLabel("DocConverter MRIS", 616, 222, 150, 17, $SS_CENTER)
$Server2Label3StatusID = GUICtrlCreateLabel($InitalServiceStatus, 800, 222, 150, 17, $SS_CENTER)
GUICtrlCreateLabel("GFI FaxMaker Server", 616, 254, 150, 17, $SS_CENTER)
$Server2Label4StatusID = GUICtrlCreateLabel($InitalServiceStatus, 800, 254, 150, 17, $SS_CENTER)
GUICtrlCreateLabel("GFI Message Transfer Agent", 616, 286, 150, 17, $SS_CENTER)
$Server2Label5StatusID = GUICtrlCreateLabel($InitalServiceStatus, 800, 286, 150, 17, $SS_CENTER)
GUICtrlCreateLabel("WSAPI", 616, 318, 150, 17, $SS_CENTER)
$Server2Label6StatusID = GUICtrlCreateLabel($InitalServiceStatus, 800, 318, 150, 17, $SS_CENTER)

;Server3 Service Name and Status
GUICtrlCreateLabel("SQL", 616, 350, 150, 17, $SS_CENTER)
$Server3Label1StatusID = GUICtrlCreateLabel($InitalServiceStatus, 800, 350, 150, 17, $SS_CENTER)
GUICtrlCreateLabel("SQL Agent", 616, 380, 150, 17, $SS_CENTER)
$Server3Label2StatusID = GUICtrlCreateLabel($InitalServiceStatus, 800, 382, 150, 17, $SS_CENTER)

;Server4 Service Name and Status
GUICtrlCreateLabel("HL7 Analyzer", 616, 414, 150, 17, $SS_CENTER)
$Server4Label1StatusID = GUICtrlCreateLabel($InitalServiceStatus, 800, 414, 150, 17, $SS_CENTER)
GUICtrlCreateLabel("HL7 Processor", 616, 446, 150, 17, $SS_CENTER)
$Server4Label2StatusID = GUICtrlCreateLabel($InitalServiceStatus, 800, 446, 150, 17, $SS_CENTER)
GUICtrlCreateLabel("HL7 Receiver", 616, 478, 150, 17, $SS_CENTER)
$Server4Label3StatusID = GUICtrlCreateLabel($InitalServiceStatus, 800, 478, 150, 17, $SS_CENTER)
GUICtrlCreateLabel("HL7 Job Monitor", 616, 510, 150, 17, $SS_CENTER)
$Server4Label4StatusID = GUICtrlCreateLabel($InitalServiceStatus, 800, 510, 150, 17, $SS_CENTER)

;Server5 Service Name and Status
GUICtrlCreateLabel("SQL", 616, 542, 150, 17, $SS_CENTER)
$Server5Label1StatusID = GUICtrlCreateLabel($InitalServiceStatus, 800, 542, 150, 17, $SS_CENTER)
GUICtrlCreateLabel("SQL Agent", 616, 574, 150, 17, $SS_CENTER)
$Server5Label2StatusID = GUICtrlCreateLabel($InitalServiceStatus, 800, 574, 150, 17, $SS_CENTER)
GUICtrlCreateLabel("BI ETL", 616, 606, 150, 17, $SS_CENTER)
$Server5Label3StatusID = GUICtrlCreateLabel($InitalServiceStatus, 800, 606, 150, 17, $SS_CENTER)
GUICtrlCreateLabel("IBM Cognos", 616, 638, 150, 17, $SS_CENTER)
$Server5Label4StatusID = GUICtrlCreateLabel($InitalServiceStatus, 800, 638, 150, 17, $SS_CENTER)

;Service Start Buttons
$Button60 = GUICtrlCreateButton("Start", 1006, 88, 81, 25)
$Button61 = GUICtrlCreateButton("Start", 1006, 120, 81, 25)
$Button62 = GUICtrlCreateButton("Start", 1006, 152, 81, 25)
$Button63 = GUICtrlCreateButton("Start", 1006, 184, 81, 25)
$Button64 = GUICtrlCreateButton("Start", 1006, 216, 81, 25)
$Button65 = GUICtrlCreateButton("Start", 1006, 248, 81, 25)
$Button66 = GUICtrlCreateButton("Start", 1006, 280, 81, 25)
$Button67 = GUICtrlCreateButton("Start", 1006, 312, 81, 25)
$Button68 = GUICtrlCreateButton("Start", 1006, 344, 81, 25)
$Button69 = GUICtrlCreateButton("Start", 1006, 376, 81, 25)
$Button70 = GUICtrlCreateButton("Start", 1006, 408, 81, 25)
$Button71 = GUICtrlCreateButton("Start", 1006, 440, 81, 25)
$Button72 = GUICtrlCreateButton("Start", 1006, 472, 81, 25)
$Button73 = GUICtrlCreateButton("Start", 1006, 504, 81, 25)
$Button74 = GUICtrlCreateButton("Start", 1006, 536, 81, 25)
$Button75 = GUICtrlCreateButton("Start", 1006, 568, 81, 25)
$Button76 = GUICtrlCreateButton("Start", 1006, 600, 81, 25)
$Button77 = GUICtrlCreateButton("Start", 1006, 632, 81, 25)

;Service Stop Buttons
$Button80 = GUICtrlCreateButton("Stop", 1190, 88, 81, 25)
$Button81 = GUICtrlCreateButton("Stop", 1190, 120, 81, 25)
$Button82 = GUICtrlCreateButton("Stop", 1190, 152, 81, 25)
$Button83 = GUICtrlCreateButton("Stop", 1190, 184, 81, 25)
$Button84 = GUICtrlCreateButton("Stop", 1190, 216, 81, 25)
$Button85 = GUICtrlCreateButton("Stop", 1190, 248, 81, 25)
$Button86 = GUICtrlCreateButton("Stop", 1190, 280, 81, 25)
$Button87 = GUICtrlCreateButton("Stop", 1190, 312, 81, 25)
$Button88 = GUICtrlCreateButton("Stop", 1190, 344, 81, 25)
$Button89 = GUICtrlCreateButton("Stop", 1190, 376, 81, 25)
$Button90 = GUICtrlCreateButton("Stop", 1190, 408, 81, 25)
$Button91 = GUICtrlCreateButton("Stop", 1190, 440, 81, 25)
$Button92 = GUICtrlCreateButton("Stop", 1190, 472, 81, 25)
$Button93 = GUICtrlCreateButton("Stop", 1190, 504, 81, 25)
$Button94 = GUICtrlCreateButton("Stop", 1190, 536, 81, 25)
$Button95 = GUICtrlCreateButton("Stop", 1190, 568, 81, 25)
$Button96 = GUICtrlCreateButton("Stop", 1190, 600, 81, 25)
$Button97 = GUICtrlCreateButton("Stop", 1190, 632, 81, 25)

; Server Restart Buttons
$Server1Restart = GUICtrlCreateButton("Restart", 223, 88, 81, 25)
$Server2Restart = GUICtrlCreateButton("Restart", 223, 152, 81, 25)
$Server3Restart = GUICtrlCreateButton("Restart", 223, 344, 81, 25)
$Server4Restart = GUICtrlCreateButton("Restart", 223, 408, 81, 25)
$Server5Restart = GUICtrlCreateButton("Restart", 223, 536, 81, 25)
$Server6Restart = GUICtrlCreateButton("Restart", 223, 721, 81, 25)
$Server7Restart = GUICtrlCreateButton("Restart", 223, 783, 81, 25)
$Server8Restart = GUICtrlCreateButton("Restart", 223, 835, 81, 25)



GUISetState(@SW_SHOW)
#EndRegion ### END Koda GUI section ###

While 1
    $nMsg = GUIGetMsg()
    Switch $nMsg
        Case $GUI_EVENT_CLOSE
            Exit
         
         Case $Server1Restart
            RestartServer1()
         
         Case $Server2Restart
            RestartServer2()
         
         Case $Server3Restart
            RestartServer3()
         
         Case $Server4Restart
            RestartServer4()
         
         Case $Server5Restart
            RestartServer5()
         
         Case $Server6Restart
            RestartServer6()
         
         Case $Server7Restart
            RestartServer7()
         
         Case $Server8Restart
            RestartServer8()
         
         Case $Button60
            Server1Service1Start()
         
         Case $Button61
            Server1Service2Start()
         
         Case $Button62
            Server2Service1Start()
         
         Case $Button63
            Server2Service2Start()
         
         Case $Button64
            Server2Service3Start()
         
         Case $Button65
            Server2Service4Start()
         
         Case $Button66
            Server2Service5Start()
         
         Case $Button67
            Server2Service6Start()
         
         Case $Button68
            Server3Service1Start()
         
         Case $Button69
            Server3Service2Start()
         
         Case $Button70
            Server4Service1Start()
         
         Case $Button71
            Server4Service2Start()
         
         Case $Button72
            Server4Service3Start()
         
         Case $Button73
            Server4Service4Start()
         
         Case $Button74
            Server5Service1Start()
         
         Case $Button75
            Server5Service2Start()
         
         Case $Button76
            Server5Service3Start()
         
         Case $Button77
            Server5Service4Start()
            
         Case $Button80
            Server1Service1Stop()
         
         Case $Button81
            Server1Service2Stop()
         
         Case $Button82
            Server2Service1Stop()
         
         Case $Button83
            Server2Service2Stop()
         
         Case $Button84
            Server2Service3Stop()
         
         Case $Button85
            Server2Service4Stop()
         
         Case $Button86
            Server2Service5Stop()
         
         Case $Button87
            Server2Service6Stop()
         
         Case $Button88
            Server3Service1Stop()
         
         Case $Button89
            Server3Service2Stop()
         
         Case $Button90
            Server4Service1Stop()
         
         Case $Button91
            Server4Service2Stop()
         
         Case $Button92
            Server4Service3Stop()
         
         Case $Button93
            Server4Service4Stop()
         
         Case $Button94
            Server5Service1Stop()
         
         Case $Button95
            Server5Service2Stop()
         
         Case $Button96
            Server5Service3Stop()
         
         Case $Button97
            Server5Service4Stop()
            
    EndSwitch
WEnd

;Restart Functions
Func RestartServer1()
   run("shutdown.exe -m \\172.20.14.162 -f -r")
EndFunc
Func RestartServer2()
   run("shutdown.exe -m \\172.20.14.163 -f -r")
EndFunc
Func RestartServer3()
   run("shutdown.exe -m \\172.20.14.164 -f -r")
EndFunc
Func RestartServer4()
   run("shutdown.exe -m \\172.20.14.165 -f -r")
EndFunc
Func RestartServer5()
   run("shutdown.exe -m \\172.20.14.169 -f -r")
EndFunc
Func RestartServer6()
   run("shutdown.exe -m \\pacs-production -f -r")
EndFunc
Func RestartServer7()
   run("shutdown.exe -m \\172.20.14.159 -f -r")
EndFunc
Func RestartServer8()
   run("shutdown.exe -m \\192.168.21.5 -f -r")
EndFunc

;Service Start Functions
Func Server1Service1Start()
   Run('sc \\172.20.14.162 start "MSSQLSERVER"', '', @SW_HIDE, 2)
EndFunc
Func Server1Service2Start()
   Run('sc \\172.20.14.162 start "SQLSERVERAGENT"', '', @SW_HIDE, 2)
EndFunc
Func Server2Service1Start()
   Run('sc \\172.20.14.163 start "AmicasVisionSeriesRisServer"', '', @SW_HIDE, 2)
EndFunc
Func Server2Service2Start()
   Run('sc \\172.20.14.163 start "bostservice"', '', @SW_HIDE, 2)
EndFunc
Func Server2Service3Start()
   Run('sc \\172.20.14.163 start "DocConverterEngine"', '', @SW_HIDE, 2)
EndFunc
Func Server2Service4Start()
   Run('sc \\172.20.14.163 start "FAXmaker Fax Server"', '', @SW_HIDE, 2)
EndFunc
Func Server2Service5Start()
   Run('sc \\172.20.14.163 start "FAXmaker MTA Service"', '', @SW_HIDE, 2)
EndFunc
Func Server2Service6Start()
   Run('sc \\172.20.14.163 start "GFI FaxMaker WSAPI"', '', @SW_HIDE, 2)
EndFunc
Func Server3Service1Start()
   Run('sc \\172.20.14.164 start "MSSQL$SCMDOCDB"', '', @SW_HIDE, 2)
EndFunc
Func Server3Service2Start()
   Run('sc \\172.20.14.164 start "SQLAgent$SCMDOCDB"', '', @SW_HIDE, 2)
EndFunc
Func Server4Service1Start()
   Run('sc \\172.20.14.165 start "MDMHL7Analyzer"', '', @SW_HIDE, 2)
EndFunc
Func Server4Service2Start()
   Run('sc \\172.20.14.165 start "MDMHL7Processor"', '', @SW_HIDE, 2)
EndFunc
Func Server4Service3Start()
   Run('sc \\172.20.14.165 start "MDMHL7Receiver"', '', @SW_HIDE, 2)
EndFunc
Func Server4Service4Start()
   Run('sc \\172.20.14.165 start "MDMJobMonitor"', '', @SW_HIDE, 2)
EndFunc
Func Server5Service1Start()
   Run('sc \\172.20.14.169 start "MSSQLSERVER"', '', @SW_HIDE, 2)
EndFunc
Func Server5Service2Start()
   Run('sc \\172.20.14.169 start "SQLSERVERAGENT"', '', @SW_HIDE, 2)
EndFunc
Func Server5Service3Start()
   Run('sc \\172.20.14.169 start "BI ETL"', '', @SW_HIDE, 2)
EndFunc
Func Server5Service4Start()
   Run('sc \\172.20.14.169 start "IBM Cognos"', '', @SW_HIDE, 2)
EndFunc

;Service Stop Functions
Func Server1Service1Stop()
   Run('sc \\172.20.14.162 stop "MSSQLSERVER"', '', @SW_HIDE, 2)
EndFunc
Func Server1Service2Stop()
   Run('sc \\172.20.14.162 stop "SQLSERVERAGENT"', '', @SW_HIDE, 2)
EndFunc
Func Server2Service1Stop()
   Run('sc \\172.20.14.163 stop "AmicasVisionSeriesRisServer"', '', @SW_HIDE, 2)
EndFunc
Func Server2Service2Stop()
   Run('sc \\172.20.14.163 stop "bostservice"', '', @SW_HIDE, 2)
EndFunc
Func Server2Service3Stop()
   Run('sc \\172.20.14.163 stop "DocConverterEngine"', '', @SW_HIDE, 2)
EndFunc
Func Server2Service4Stop()
   Run('sc \\172.20.14.163 stop "FAXmaker Fax Server"', '', @SW_HIDE, 2)
EndFunc
Func Server2Service5Stop()
   Run('sc \\172.20.14.163 stop "FAXmaker MTA Service"', '', @SW_HIDE, 2)
EndFunc
Func Server2Service6Stop()
   Run('sc \\172.20.14.163 stop "GFI FaxMaker WSAPI"', '', @SW_HIDE, 2)
EndFunc
Func Server3Service1Stop()
   Run('sc \\172.20.14.164 stop "MSSQL$SCMDOCDB"', '', @SW_HIDE, 2)
EndFunc
Func Server3Service2Stop()
   Run('sc \\172.20.14.164 stop "SQLAgent$SCMDOCDB"', '', @SW_HIDE, 2)
EndFunc
Func Server4Service1Stop()
   Run('sc \\172.20.14.165 stop "MDMHL7Analyzer"', '', @SW_HIDE, 2)
EndFunc
Func Server4Service2Stop()
   Run('sc \\172.20.14.165 stop "MDMHL7Processor"', '', @SW_HIDE, 2)
EndFunc
Func Server4Service3Stop()
   Run('sc \\172.20.14.165 stop "MDMHL7Receiver"', '', @SW_HIDE, 2)
EndFunc
Func Server4Service4Stop()
   Run('sc \\172.20.14.165 stop "MDMJobMonitor"', '', @SW_HIDE, 2)
EndFunc
Func Server5Service1Stop()
   Run('sc \\172.20.14.169 stop "MSSQLSERVER"', '', @SW_HIDE, 2)
EndFunc
Func Server5Service2Stop()
   Run('sc \\172.20.14.169 stop "SQLSERVERAGENT"', '', @SW_HIDE, 2)
EndFunc
Func Server5Service3Stop()
   Run('sc \\172.20.14.169 stop "BI ETL"', '', @SW_HIDE, 2)
EndFunc
Func Server5Service4Stop()
   Run('sc \\172.20.14.169 stop "IBM Cognos"', '', @SW_HIDE, 2)
EndFunc
Edited by DanielMathis
Link to comment
Share on other sites

Something like this.

GUISetState(@SW_SHOW)
#EndRegion ### END Koda GUI section ###

$Timer = TimerInit()
While 1
    ; If 5 seconds has passed, call function and reset timer
    If TimerDiff($Timer) >- (1000 * 5) Then
        _UpdateServerStatus()
        $Timer = TimerInit()
    EndIf
    
    $nMsg = GUIGetMsg()
    Switch $nMsg
        Case $GUI_EVENT_CLOSE
            Exit

        Case $Server1Restart
            RestartServer1()

        Case $Server2Restart
            RestartServer2()

        Case $Server3Restart
            RestartServer3()

        Case $Server4Restart
            RestartServer4()

        Case $Server5Restart
            RestartServer5()

        Case $Server6Restart
            RestartServer6()

        Case $Server7Restart
            RestartServer7()

        Case $Server8Restart
            RestartServer8()

        Case $Button60
            Server1Service1Start()

        Case $Button61
            Server1Service2Start()

        Case $Button62
            Server2Service1Start()

        Case $Button63
            Server2Service2Start()

        Case $Button64
            Server2Service3Start()

        Case $Button65
            Server2Service4Start()

        Case $Button66
            Server2Service5Start()

        Case $Button67
            Server2Service6Start()

        Case $Button68
            Server3Service1Start()

        Case $Button69
            Server3Service2Start()

        Case $Button70
            Server4Service1Start()

        Case $Button71
            Server4Service2Start()

        Case $Button72
            Server4Service3Start()

        Case $Button73
            Server4Service4Start()

        Case $Button74
            Server5Service1Start()

        Case $Button75
            Server5Service2Start()

        Case $Button76
            Server5Service3Start()

        Case $Button77
            Server5Service4Start()

        Case $Button80
            Server1Service1Stop()

        Case $Button81
            Server1Service2Stop()

        Case $Button82
            Server2Service1Stop()

        Case $Button83
            Server2Service2Stop()

        Case $Button84
            Server2Service3Stop()

        Case $Button85
            Server2Service4Stop()

        Case $Button86
            Server2Service5Stop()

        Case $Button87
            Server2Service6Stop()

        Case $Button88
            Server3Service1Stop()

        Case $Button89
            Server3Service2Stop()

        Case $Button90
            Server4Service1Stop()

        Case $Button91
            Server4Service2Stop()

        Case $Button92
            Server4Service3Stop()

        Case $Button93
            Server4Service4Stop()

        Case $Button94
            Server5Service1Stop()

        Case $Button95
            Server5Service2Stop()

        Case $Button96
            Server5Service3Stop()

        Case $Button97
            Server5Service4Stop()

    EndSwitch
WEnd

Notice $Timer is declared outside the loop.

AutoIt Absolute Beginners    Require a serial    Pause Script    Video Tutorials by Morthawt   ipify 

Monkey's are, like, natures humans.

Link to comment
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
 Share

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...