JunkieKing Posted September 25, 2009 Share Posted September 25, 2009 Hi Gurus,I have created a script (attached) that allows me to view and monitor my company network. But the time from executing the file to response and show the GUI is slow (might be the pinging that causes this). Is there anyway that I could clean up the script? I am not a programming person and I've never write a program before, just trying out and see what AutoIT can help me in my daily work. I would like to add a Download speed and upload speed checker that shows how fast or slow my network is in kbps. I have search through the forum but to no avail. Guess I am not searching hard enough? Please advice? expandcollapse popup#include <GUIConstants.au3> $PingSvrMB = GUICreate("WMC Network Monitoring Utilities Tools", 357, 506, 265, 187) $GroupBox1 = GUICtrlCreateGroup("", 14, 8, 327, 134) GUICtrlCreateLabel("Regions Router", 20, 8, 80, 17) $Btn_SGP = GUICtrlCreateButton("Singapore", 24, 24, 89, 33, 0) GUICtrlCreateLabel("Ping 1-20", 44, 58, 80, 17) $Btn_HKG = GUICtrlCreateButton("HongKong", 134, 24, 89, 33, 0) GUICtrlCreateLabel("Ping 20-50", 150, 58, 80, 17) $Btn_TOK = GUICtrlCreateButton("Tokyo", 244, 24, 89, 33, 0) GUICtrlCreateLabel("Ping 80-130", 258, 58, 80, 17) $Btn_SYD = GUICtrlCreateButton("Sydney", 24, 84, 89, 33, 0) GUICtrlCreateLabel("Ping 110-160", 36, 118, 80, 17) $Btn_LON = GUICtrlCreateButton("London", 134, 84, 89, 33, 0) GUICtrlCreateLabel("Ping 235-275", 146, 118, 80, 17) GUICtrlCreateGroup("", -99, -99, 1, 1) _PingIt() $GroupBox2 = GUICtrlCreateGroup("", 14, 150, 327, 275) GUICtrlCreateLabel("HTTP Watch Check", 20, 152, 105, 17) $Btn_GoogSG = GUICtrlCreateButton("www.google.com.sg", 24, 168, 150, 20, 0) GUICtrlCreateLabel("141ms -", 180, 172, 50, 17) $Bth_GoogSGTxt = GUICtrlCreateInput(Ping("www.google.com.sg"), 230, 170, 50, 17) ;GUICtrlSetState(-1, $GUI_DISABLE) ; ==> Google SG Ping $Btn_GoogHK = GUICtrlCreateButton("www.google.com.hk", 24, 190, 150, 20, 0) GUICtrlCreateLabel("192ms -", 180, 194, 50, 17) $Bth_GoogHKTxt = GUICtrlCreateInput(Ping("www.google.com.hk"), 230, 192, 50, 17) ;GUICtrlSetState(-1, $GUI_DISABLE) ; ==> Google HK Ping $Btn_YahooSG = GUICtrlCreateButton("www.yahoo.com.sg", 24, 212, 150, 20, 0) GUICtrlCreateLabel("489ms -", 180, 216, 50, 17) $Bth_YahooSGTxt = GUICtrlCreateInput(Ping("www.yahoo.com.sg"), 230, 215, 50, 17) ;GUICtrlSetState(-1, $GUI_DISABLE) ; ==> Yahoo SG Ping $Btn_YahooHK = GUICtrlCreateButton("www.yahoo.com.hk", 24, 234, 150, 20, 0) GUICtrlCreateLabel("363ms -", 180, 238, 50, 17) $Bth_YahooHKTxt = GUICtrlCreateInput(Ping("www.yahoo.com.hk"), 230, 237, 50, 17) ;GUICtrlSetState(-1, $GUI_DISABLE) ; ==> Yahoo HK Ping $Btn_ST = GUICtrlCreateButton("www.straitstimes.com", 24, 256, 150, 20, 0) GUICtrlCreateLabel("239ms -", 180, 260, 50, 17) $Bth_STTxt = GUICtrlCreateInput(Ping("www.straitstimes.com"), 230, 258, 50, 17) ;GUICtrlSetState(-1, $GUI_DISABLE) ; ==> Straits Times Ping $Btn_WMC = GUICtrlCreateButton("intranet.wellmanage.com", 24, 278, 150, 20, 0) GUICtrlCreateLabel("114ms -", 180, 282, 50, 17) $Bth_WMCTxt = GUICtrlCreateInput(Ping("intranet.wellmanage.com"), 230, 280, 50, 17) ;GUICtrlSetState(-1, $GUI_DISABLE) ; ==> WMC Intranet Ping $Btn_TO = GUICtrlCreateButton("www.todayonline.com", 24, 300, 150, 20, 0) GUICtrlCreateLabel("265ms -", 180, 304, 50, 17) $Bth_TOTxt = GUICtrlCreateInput(Ping("www.todayonline.com"), 230, 302, 50, 17) ;GUICtrlSetState(-1, $GUI_DISABLE) ; ==> Today Online Ping $Btn_Poem = GUICtrlCreateButton("www.poems.com.sg", 24, 322, 150, 20, 0) GUICtrlCreateLabel("76ms -", 180, 326, 50, 17) $Bth_PoemTxt = GUICtrlCreateInput(Ping("www.poems.com.sg"), 230, 324, 50, 17) ;GUICtrlSetState(-1, $GUI_DISABLE) ; ==> Poems Ping $Btn_CB = GUICtrlCreateButton("www.citibank.com.sg", 24, 344, 150, 20, 0) GUICtrlCreateLabel("63ms -", 180, 348, 50, 17) $Bth_CBTxt = GUICtrlCreateInput(Ping("www.citibank.com.sg"), 230, 346, 50, 17) ;GUICtrlSetState(-1, $GUI_DISABLE) ; ==> Citibank Ping $Btn_MAS = GUICtrlCreateButton("www.mas.gov.sg", 24, 366, 150, 20, 0) GUICtrlCreateLabel("53ms -", 180, 370, 50, 17) $Bth_MASTxt = GUICtrlCreateInput(Ping("www.mas.gov.sg"), 230, 368, 50, 17) ;GUICtrlSetState(-1, $GUI_DISABLE) ; ==> MAS Ping $Btn_GIC = GUICtrlCreateButton("www.gic.com.sg", 24, 388, 150, 20, 0) GUICtrlCreateLabel("36ms -", 180, 392, 50, 17) $Bth_GICTxt = GUICtrlCreateInput(Ping("www.gic.com.sg"), 230, 390, 50, 17) ;GUICtrlSetState(-1, $GUI_DISABLE) ; ==> GIC Ping GUICtrlCreateGroup("", -99, -99, 1, 1) $Refresh = GUICtrlCreateButton("Refresh", 298, 382, 35, 35, 0) $Terminate = GUICtrlCreateButton("&Exit", 272, 448, 75, 25, 0) HotKeySet("{ESC}", "terminate") HotKeySet("{F1}", "Help") GUISetState(@SW_SHOW) While 1 $nMsg = GUIGetMsg() Switch $nMsg Case $GUI_EVENT_CLOSE Terminate() Case $Terminate Terminate() Case $Btn_SGP MsgBox(0, "Ping Result", Ping("<SG Router>")) Case $Btn_HKG MsgBox(0, "Ping Result", Ping("<HK Router>")) Case $Btn_TOK MsgBox(0, "Ping Result", Ping("<TOK Router>")) Case $Btn_SYD MsgBox(0, "Ping Result", Ping("<Sydney Router>")) Case $Btn_Lon MsgBox(0, "Ping Result", Ping("<London Router>")) ;EndSwitch If (NOT Mod(@Min, 5)) AND @SEC = 0 Then _PingIt() Case $Btn_GoogSG GUICtrlCreateInput(Ping("www.google.com.sg"), 230, 170, 50, 17) Case $Btn_GoogHK GUICtrlCreateInput(Ping("www.google.com.hk"), 230, 192, 50, 17) Case $Btn_YahooSG GUICtrlCreateInput(Ping("www.yahoo.com.sg"), 230, 215, 50, 17) Case $Btn_YahooHK GUICtrlCreateInput(Ping("www.yahoo.com.hk"), 230, 237, 50, 17) Case $Btn_ST GUICtrlCreateInput(Ping("www.straitstimes.com"), 230, 258, 50, 17) Case $Btn_WMC GUICtrlCreateInput(Ping("intranet.wellmanage.com"), 230, 280, 50, 17) Case $Btn_TO GUICtrlCreateInput(Ping("www.todayonline.com"), 230, 302, 50, 17) Case $Btn_Poem GUICtrlCreateInput(Ping("www.poems.com.sg"), 230, 324, 50, 17) Case $Btn_CB GUICtrlCreateInput(Ping("www.citibank.com.sg"), 230, 346, 50, 17) Case $Btn_MAS GUICtrlCreateInput(Ping("www.mas.gov.sg"), 230, 368, 50, 17) Case $Btn_GIC GUICtrlCreateInput(Ping("www.gic.com.sg"), 230, 390, 50, 17) Case $Refresh GUICtrlCreateInput(Ping("www.google.com.sg"), 230, 170, 50, 17) GUICtrlCreateInput(Ping("www.google.com.hk"), 230, 192, 50, 17) GUICtrlCreateInput(Ping("www.yahoo.com.sg"), 230, 215, 50, 17) GUICtrlCreateInput(Ping("www.yahoo.com.hk"), 230, 237, 50, 17) GUICtrlCreateInput(Ping("www.straitstimes.com"), 230, 258, 50, 17) GUICtrlCreateInput(Ping("intranet.wellmanage.com"), 230, 280, 50, 17) GUICtrlCreateInput(Ping("www.todayonline.com"), 230, 302, 50, 17) GUICtrlCreateInput(Ping("www.poems.com.sg"), 230, 324, 50, 17) GUICtrlCreateInput(Ping("www.citibank.com.sg"), 230, 346, 50, 17) GUICtrlCreateInput(Ping("www.mas.gov.sg"), 230, 368, 50, 17) GUICtrlCreateInput(Ping("www.gic.com.sg"), 230, 390, 50, 17) EndSwitch WEnd Func _PingIt() If Ping("SNG-15-MDF-A-L3", 50) Then ;GUICtrlSetBkColor($Btn_SGP, 0x009900) Else GUICtrlSetBkColor($Btn_SGP, 0xCC0000) EndIf If Ping("HK-32-MDF-A-L3", 150) Then ;GUICtrlSetBkColor($Btn_HKG, 0x009900) Else GUICtrlSetBkColor($Btn_HKG, 0xCC0000) EndIf If Ping("TOK-15-MDF-A-L3", 150) Then ;GUICtrlSetBkColor($Btn_HKG, 0x009900) Else GUICtrlSetBkColor($Btn_TOK, 0xCC0000) EndIf If Ping("SYD-17-MDF-A-L3", 150) Then ;GUICtrlSetBkColor($Btn_HKG, 0x009900) Else GUICtrlSetBkColor($Btn_SYD, 0xCC0000) EndIf If Ping("Lon-8-MDF-A-L3", 400) Then ;GUICtrlSetBkColor($Btn_HKG, 0x009900) Else GUICtrlSetBkColor($Btn_Lon, 0xCC0000) EndIf ;GUICtrlCreateInput(Ping("www.google.com" & "sec"), 100, 100, 50, 20) ;GUICtrlSetState(-1, $GUI_DISABLE) EndFunc ; Help Functions Func Help() MsgBox(4096,"ANT Contact Information","Please dail +65 6748 2297 for support") EndFunc;==>HelpInfo ; Cancel then Exit the program Func Terminate() Local $Terminate $Terminate = MsgBox(262452,"WMC Network Monitoring Utilities Tools Exit","Thanks for using our Network Monitoring Utilities."& @CRLF &"For more details, please call our Solutions Center at x68400") If $Terminate = 6 Then Exit Endif EndFunc Link to comment Share on other sites More sharing options...
PsaltyDS Posted September 25, 2009 Share Posted September 25, 2009 Create and display the GUI without filling in data, then run a loop that gathers the data and updates the GUI as it goes along. Valuater's AutoIt 1-2-3, Class... Is now in Session!For those who want somebody to write the script for them: RentACoder"Any technology distinguishable from magic is insufficiently advanced." -- Geek's corollary to Clarke's law Link to comment Share on other sites More sharing options...
JunkieKing Posted September 26, 2009 Author Share Posted September 26, 2009 Create and display the GUI without filling in data, then run a loop that gathers the data and updates the GUI as it goes along. Great idea! Let me figure out how to display the GUI and how to loop so that it gathers data and updates the GUI. Is it possible to write a little script for me to start off with?And how about writing the Download and Upload Speed script? Tried search through the forum but to no avail. Link to comment Share on other sites More sharing options...
PsaltyDS Posted September 27, 2009 Share Posted September 27, 2009 Great idea! Let me figure out how to display the GUI and how to loop so that it gathers data and updates the GUI. Yes, we'll let you.Is it possible to write a little script for me to start off with?No. But once you try to do it yourself, if you get stuck, post your code and a more specific question. You'll get lots of help for you doing it, not much help for doing it for you.And how about writing the Download and Upload Speed script? Tried search through the forum but to no avail.I don't know why you'd bother scripting something you can get better from free services online. Learn to use the IE.au3 functions and use them to access your favorite speedometer site. Valuater's AutoIt 1-2-3, Class... Is now in Session!For those who want somebody to write the script for them: RentACoder"Any technology distinguishable from magic is insufficiently advanced." -- Geek's corollary to Clarke's law 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