BinaryBrother Posted April 15, 2009 Share Posted April 15, 2009 expandcollapse popup#Include <Array.au3> #include <File.au3> #include <String.au3> Global $TechName[1] Global $TechIP[1] Global $Activity $inidir = @TempDir & "\aRDP\helpdesk.txt" For $N = 1 To _FileCountLines($inidir) $FileLine = FileReadLine($inidir,$N) If StringInStr($FileLine,"[HOST]") Then _ArrayAdd($TechName,FileReadLine($inidir,$N + 1)) _ArrayAdd($TechIP,FileReadLine($inidir,$N + 2)) EndIf Next $TechIP[0] = Ubound($TechIP,0) + 1 For $N = 1 To $TechIP[0] $TechIP[$N] = StringReplace($TechIP[$N], "-connect ", "") $TechIP[$N] = StringReplace($TechIP[$N], ":5500 -noregistry", "") Next #include <ButtonConstants.au3> #include <GUIConstantsEx.au3> #include <GUIListBox.au3> #include <StaticConstants.au3> #include <WindowsConstants.au3> #Region ### START Koda GUI section ### Form= $Form1 = GUICreate("H.A.C. Support", 207, 396, 203, 163) $Label1 = GUICtrlCreateLabel("Available Techs:", 8, 8, 181, 34) GUICtrlSetFont(-1, 16, 800, 0, "Comic Sans MS") $List1 = GUICtrlCreateList("", 8, 48, 185, 253) GUICtrlSetData(-1, "Waiting for Technicians...") GUICtrlSetFont(-1, 12, 800, 0, "Constantia") GUICtrlSetColor(-1, 0x800000) $Button1 = GUICtrlCreateButton("Request Assistance", 16, 320, 163, 57, 0) GUISetState(@SW_SHOW) #EndRegion ### END Koda GUI section ### While 1 $nMsg = GUIGetMsg() Switch $nMsg Case $GUI_EVENT_CLOSE Exit Case Else Sleep(2000) For $N = 1 To $TechIP[0] If Not Ping($TechIP[$N]) = 0 Then GUICtrlSetData($List1, $TechName[$N]) EndIf Next EndSwitch WEndI know some of that is out of alighment... I kept it like that to help me keep the GUI and Other code Separated for now... I've got a weird way to doing it... Once it's finished it will be merged... Anyway...OS: Win_VistaIssue: The GUI freezes up every few seconds, I believe "Ping" is doing it...I just basically need a second pair of eyes... Did I miss something? SIGNATURE_0X800007D NOT FOUND Link to comment Share on other sites More sharing options...
PsaltyDS Posted April 15, 2009 Share Posted April 15, 2009 CODE#Include <Array.au3> #include <File.au3> #include <String.au3> Global $TechName[1] Global $TechIP[1] Global $Activity $inidir = @TempDir & "\aRDP\helpdesk.txt" For $N = 1 To _FileCountLines($inidir) $FileLine = FileReadLine($inidir,$N) If StringInStr($FileLine,"[HOST]") Then _ArrayAdd($TechName,FileReadLine($inidir,$N + 1)) _ArrayAdd($TechIP,FileReadLine($inidir,$N + 2)) EndIf Next $TechIP[0] = Ubound($TechIP,0) + 1 For $N = 1 To $TechIP[0] $TechIP[$N] = StringReplace($TechIP[$N], "-connect ", "") $TechIP[$N] = StringReplace($TechIP[$N], ":5500 -noregistry", "") Next #include <ButtonConstants.au3> #include <GUIConstantsEx.au3> #include <GUIListBox.au3> #include <StaticConstants.au3> #include <WindowsConstants.au3> #Region ### START Koda GUI section ### Form= $Form1 = GUICreate("H.A.C. Support", 207, 396, 203, 163) $Label1 = GUICtrlCreateLabel("Available Techs:", 8, 8, 181, 34) GUICtrlSetFont(-1, 16, 800, 0, "Comic Sans MS") $List1 = GUICtrlCreateList("", 8, 48, 185, 253) GUICtrlSetData(-1, "Waiting for Technicians...") GUICtrlSetFont(-1, 12, 800, 0, "Constantia") GUICtrlSetColor(-1, 0x800000) $Button1 = GUICtrlCreateButton("Request Assistance", 16, 320, 163, 57, 0) GUISetState(@SW_SHOW) #EndRegion ### END Koda GUI section ### While 1 $nMsg = GUIGetMsg() Switch $nMsg Case $GUI_EVENT_CLOSE Exit Case Else Sleep(2000) For $N = 1 To $TechIP[0] If Not Ping($TechIP[$N]) = 0 Then GUICtrlSetData($List1, $TechName[$N]) EndIf Next EndSwitch WEndI know some of that is out of alighment... I kept it like that to help me keep the GUI and Other code Separated for now... I've got a weird way to doing it... Once it's finished it will be merged... Anyway... OS: Win_Vista Issue: The GUI freezes up every few seconds, I believe "Ping" is doing it... I just basically need a second pair of eyes... Did I miss something? You don't want slow things like "Sleep(2000)" inside a GUI message loop. You might consider AdLibEnable() to run the ping check every 2sec and remove that from the message loop. Also, this is a logic error, or at least unclear: "If Not Ping($TechIP[$N]) = 0 Then" In AutoIt's order of operations, "NOT" comes before "=", so that in effect is: "If ( Not Ping($TechIP[$N]) ) = 0 Then" For clarity use the not equal operator "<>": "If Ping($TechIP[$N]) <> 0 Then" 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...
BinaryBrother Posted April 15, 2009 Author Share Posted April 15, 2009 I even tried an OnEvent GUI, and Ping Still freezes the GUI everytime it pings... So in relation to your answer on another post, I've decided to check the see if the service on the machine is accepting connections, rather than ping it to see if the server is alive. Thanks. Oh and thanks for the $Ping bit... SIGNATURE_0X800007D NOT FOUND 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