seesoe Posted April 6, 2009 Share Posted April 6, 2009 (edited) the following script is a pinging script that will ping a website every x set of minutes i have it working with manually declaring to ping site 1, but how would i make it where it will ping a site every x amount of minutes, which gets declared in the gui? expandcollapse popup#include <GUIConstants.au3> #include "GuiListView.au3" #Region ### START Koda GUI section ### Form= $Form1 = GUICreate("DSL Pinger", 353, 474, 324, 159) $ip_1 = GUICtrlCreateLabel("IP 1", 24, 32, 28, 17) $ip_2 = GUICtrlCreateLabel("IP 2", 24, 64, 28, 17) $ip_3 = GUICtrlCreateLabel("IP 3", 24, 96, 28, 17) $ip_4 = GUICtrlCreateLabel("IP 4", 24, 128, 28, 17) $ip_5 = GUICtrlCreateLabel("IP 5", 24, 160, 28, 17) $ip_6 = GUICtrlCreateLabel("IP 6", 176, 32, 28, 17) $ip_7 = GUICtrlCreateLabel("IP 7", 176, 64, 28, 17) $ip_8 = GUICtrlCreateLabel("IP 8", 176, 96, 28, 17) $ip_9 = GUICtrlCreateLabel("IP 9", 176, 128, 28, 17) $ip_10 = GUICtrlCreateLabel("IP 10", 176, 160, 34, 17) $ListView1 = GUICtrlCreateListView("Site Pingged|Time In (MS)|Status", 16, 248, 314, 206) GUICtrlSendMsg(-1, 0x101E, 0, 50) $Input1 = GUICtrlCreateInput("www.google.com", 48, 32, 121, 21) $Input2 = GUICtrlCreateInput("www.ebay.com", 48, 64, 121, 21) $Input3 = GUICtrlCreateInput("www.msn.com", 48, 96, 121, 21) $Input4 = GUICtrlCreateInput("www.microsoft.com", 48, 128, 121, 21) $Input5 = GUICtrlCreateInput("www.yahoo.com", 48, 160, 121, 21) $Input6 = GUICtrlCreateInput("www.amazon.com", 208, 32, 121, 21) $Input7 = GUICtrlCreateInput("www.uf.edu", 208, 64, 121, 21) $Input8 = GUICtrlCreateInput("www.facebook.com", 208, 96, 121, 21) $Input9 = GUICtrlCreateInput("www.myspace.com", 208, 128, 121, 21) $Input10 = GUICtrlCreateInput("www.gmail.com", 208, 160, 121, 21) $Group1 = GUICtrlCreateGroup("IP's To Ping", 8, 8, 337, 185) GUICtrlCreateGroup("", -99, -99, 1, 1) $Group2 = GUICtrlCreateGroup("Ping Results", 8, 232, 337, 233) GUICtrlCreateGroup("", -99, -99, 1, 1) $ping_s_s = GUICtrlCreateButton("Start Pings", 8, 200, 75, 25) $ping_status = GUICtrlCreateLabel("Ping Not Started", 200, 208, 138, 17) $ping_x_l = GUICtrlCreateLabel("Ping x A Min", 88, 208, 66, 17) $ping_x = GUICtrlCreateInput("5", 160, 208, 25, 21) GUISetState(@SW_SHOW) #EndRegion ### END Koda GUI section ### _GUICtrlListView_SetColumnWidth($ListView1, 0, 150) _GUICtrlListView_SetColumnWidth($ListView1, 1, 95) _GUICtrlListView_SetColumnWidth($ListView1, 2, 58) Dim $ip[11] $ip[1] = GUICtrlRead($Input1) $ip[2] = GUICtrlRead($Input2) $ip[3] = GUICtrlRead($Input3) $ip[4] = GUICtrlRead($Input4) $ip[5] = GUICtrlRead($Input5) $ip[6] = GUICtrlRead($Input6) $ip[7] = GUICtrlRead($Input7) $ip[8] = GUICtrlRead($Input8) $ip[9] = GUICtrlRead($Input9) $ip[10] = GUICtrlRead($Input10) $connected = False While 1+1 $msg = GUIGetMsg() If $msg = $GUI_EVENT_CLOSE Then If $connected == True Then If MsgBox(4, "WARNING! - Exiting Program!","Are you sure you want to stop ping server?") == 6 Then Exit EndIf Elseif $connected == False Then Exit EndIf EndIf If $msg = $ping_s_s Then If Not $connected Then $result = WMI_Ping($ip[1],32,false,0,True) If NOT @ERROR Then _GUICtrlListView_SetColumnWidth($ListView1, 0, 150) _GUICtrlListView_SetColumnWidth($ListView1, 1, 95) _GUICtrlListView_SetColumnWidth($ListView1, 2, 58) GUICtrlCreateListViewItem($ip[1] & "|" & $result[0] & "|Pass",$ListView1) GUICtrlSetData($ping_s_s,"Stop Pings") guictrlsetdata($ping_status,'Pinging "site".') $connected = True Else GUICtrlCreateListViewItem($ip[1] & "|" & $result[0] & "|Faild",$ListView1) GUICtrlSetData($ping_status,"Ping Can't Be Sent.") $connected = False EndIf Else GUICtrlSetData($ping_s_s,"Start Pings") GUICtrlSetData($ping_status,"Ping Stopped") $connected = False EndIf EndIf WEnd #cs -------------------------------------------------------------------------------------------------------- Name: WMI_Ping Description: Ping a remote computer via WMI Author: WeaponX Parameters: (6 - Str,Int,Bool,Int,Bool,Str) Address (String) - Hostname, IPv4 address, or IPv6 address (Vista only) BufferSize (Integer) - Buffer size sent with the ping command. The default value is 32. NoFragmentation (Boolean) - If TRUE, "Do not Fragment" is marked on the packets sent. The default is FALSE, not fragmented. RecordRoute (Integer) - How many hops should be recorded while the packet is in route. The default is 0 (zero). ResolveAddressNames (Boolean) - Command resolves address names of output address values. The default is FALSE, which indicates no resolution. SourceRoute (String) - Comma-separated list of valid Source Routes. The default is "". Return: (Int) Success - Response time in milliseconds Failure - Status code and @ERROR = 1 Failure creating object - 0 and @ERROR = 2 #ce -------------------------------------------------------------------------------------------------------- Func WMI_Ping($sAddress = "127.0.0.1", $iBufferSize = 32, $bNoFragmentation = False, $iRecordRoute = 0, $bResolveAddressNames = False, $sSourceRoute = "") Local $colItems = "", $strComputer = "localhost", $strStatusCode = 0, $strResponseTime = 0 Local $objWMIService = ObjGet("winmgmts:\\" & $strComputer & "\root\CIMV2") Local $sQuery = "SELECT * FROM Win32_PingStatus WHERE " $sQuery &= "address = '" & $sAddress & "' " $sQuery &= "AND BufferSize = " & $iBufferSize & " " $sQuery &= "AND NoFragmentation = " & $bNoFragmentation & " " $sQuery &= "AND RecordRoute = " & $iRecordRoute & " " $sQuery &= "AND ResolveAddressNames = " & $bResolveAddressNames & " " $sQuery &= "AND SourceRoute = '" & $sSourceRoute & "'" $colItems = $objWMIService.ExecQuery($sQuery, "WQL", 0x10 + 0x20) global $Output[24] If IsObj($colItems) Then $Output[23] = ObjName($colItems) For $objItem In $colItems $Output[1] = $objItem.Address $Output[2] = $objItem.BufferSize $Output[3] = $objItem.NoFragmentation $Output[4] = $objItem.PrimaryAddressResolutionStatus $Output[5] = $objItem.ProtocolAddress $Output[6] = $objItem.ProtocolAddressResolved $Output[7] = $objItem.RecordRoute $Output[8] = $objItem.ReplyInconsistency $Output[9] = $objItem.ReplySize $Output[10] = $objItem.ResolveAddressNames $Output[0] = $objItem.ResponseTime $Output[11] = $objItem.RouteRecord(0) $Output[12] = $objItem.RouteRecordResolved(0) $Output[13] = $objItem.SourceRoute $Output[14] = $objItem.SourceRouteType $Output[15] = $objItem.StatusCode $Output[16] = $objItem.Timeout $Output[17] = $objItem.TimeStampRecord(0) $Output[18] = $objItem.TimeStampRecordAddress(0) $Output[19] = $objItem.TimeStampRecordAddressResolved(0) $Output[20]&= $objItem.TimestampRoute $Output[21] &= $objItem.TimeToLive $Output[22] &= $objItem.TypeofService Next If $strStatusCode <> 0 Then Return SetError(1,0,$strStatusCode) Else Return $Output EndIf Else Return SetError(2,0,0) EndIf EndFunc ;==>WMI_Pin Edited April 6, 2009 by seesoe Link to comment Share on other sites More sharing options...
computergroove Posted April 6, 2009 Share Posted April 6, 2009 DO you want to type the amount of minutes/seconds in a text box or choose from a drop down of pre-determined minute increments? Get Scite to add a popup when you use a 3rd party UDF -> http://www.autoitscript.com/autoit3/scite/docs/SciTE4AutoIt3/user-calltip-manager.html Link to comment Share on other sites More sharing options...
seesoe Posted April 8, 2009 Author Share Posted April 8, 2009 well at first i just wanted to type it in to the text box, but now that you ask it does make sense to choose from a list, so yeah choose from predefined from a drop down. Link to comment Share on other sites More sharing options...
seesoe Posted April 18, 2009 Author Share Posted April 18, 2009 i still couldn't figure this out, any one please? Link to comment Share on other sites More sharing options...
John117 Posted April 18, 2009 Share Posted April 18, 2009 (edited) Sorry, too tired to read your script and its too long to get help from others . . . sounds like you need a timer. heres a good one $hWnd = "Your gui goes here" $Input = GUICtrlCreateInput("1000", 10, 5, 300, 20) ;or whatever you want to get the timer countdown from. Global $AGoodTimer= _Timer_SetTimer($hWnd, GuiCtrlRead($Input), "YourFunction", -1) ;this will loop until you kill it. -its external to your script. Func YourFunction($hWnd, $iMsg, $iwParam, $ilParam) ;you need these ;Do Something cool here EndFunc Func Terminate() _Timer_KillAllTimers($hWnd) ;Don't forget this EndFunc nite Edit: oh yeah #include <Timers.au3> Edited April 18, 2009 by Hatcheda Link to comment Share on other sites More sharing options...
P0ZiTR0N Posted April 18, 2009 Share Posted April 18, 2009 (edited) No.. IMHO you're wrong.. he needed combo: expandcollapse popup#include <GUIConstants.au3> #include "GuiListView.au3" #Region ### START Koda GUI section ### Form= $Form1 = GUICreate("DSL Pinger", 353, 474, 324, 159) $ip_1 = GUICtrlCreateLabel("IP 1", 24, 32, 28, 17) $ip_2 = GUICtrlCreateLabel("IP 2", 24, 64, 28, 17) $ip_3 = GUICtrlCreateLabel("IP 3", 24, 96, 28, 17) $ip_4 = GUICtrlCreateLabel("IP 4", 24, 128, 28, 17) $ip_5 = GUICtrlCreateLabel("IP 5", 24, 160, 28, 17) $ip_6 = GUICtrlCreateLabel("IP 6", 176, 32, 28, 17) $ip_7 = GUICtrlCreateLabel("IP 7", 176, 64, 28, 17) $ip_8 = GUICtrlCreateLabel("IP 8", 176, 96, 28, 17) $ip_9 = GUICtrlCreateLabel("IP 9", 176, 128, 28, 17) $ip_10 = GUICtrlCreateLabel("IP 10", 176, 160, 34, 17) $ListView1 = GUICtrlCreateListView("Site Pingged|Time In (MS)|Status", 16, 248, 314, 206) GUICtrlSendMsg(-1, 0x101E, 0, 50) $Input1 = GUICtrlCreateInput("www.google.com", 48, 32, 121, 21) $Input2 = GUICtrlCreateInput("www.ebay.com", 48, 64, 121, 21) $Input3 = GUICtrlCreateInput("www.msn.com", 48, 96, 121, 21) $Input4 = GUICtrlCreateInput("www.microsoft.com", 48, 128, 121, 21) $Input5 = GUICtrlCreateInput("www.yahoo.com", 48, 160, 121, 21) $Input6 = GUICtrlCreateInput("www.amazon.com", 208, 32, 121, 21) $Input7 = GUICtrlCreateInput("www.uf.edu", 208, 64, 121, 21) $Input8 = GUICtrlCreateInput("www.facebook.com", 208, 96, 121, 21) $Input9 = GUICtrlCreateInput("www.myspace.com", 208, 128, 121, 21) $Input10 = GUICtrlCreateInput("www.gmail.com", 208, 160, 121, 21) $Group1 = GUICtrlCreateGroup("IP's To Ping", 8, 8, 337, 185) GUICtrlCreateGroup("", -99, -99, 1, 1) $Group2 = GUICtrlCreateGroup("Ping Results", 8, 232, 337, 233) GUICtrlCreateGroup("", -99, -99, 1, 1) $ping_s_s = GUICtrlCreateButton("Start Pings", 8, 200, 75, 25) $ping_status = GUICtrlCreateLabel("Ping Not Started", 200, 208, 138, 17) $ping_x_l = GUICtrlCreateLabel("Ping x A Min", 88, 208, 66, 17) $ping_x = GUICtrlCreateInput("5", 160, 208, 25, 21) ; combo list with display-data ;~ GuiCtrlCreateLabel("Height:", 30, 172) ;~ $savedtime=IniRead ( "settings.ini", "TIME", "time_set", "" ) ;~ $actualtime=GuiCtrlCreateLabel(""&$savedtime& "", 248, 8,25,20,0x1000) ;~ $timelab = GuiCtrlCreateCombo("5", 275, 8, 70, 21) ;~ GuiCtrlSetData($timelab, "20|60") GuiCtrlCreateLabel("Key:", 31, 260) $savedtimeset=IniRead ( "settings.ini", "TIME", "time_set", "" ) $actuatimeset=GuiCtrlCreateLabel(""&$savedtimeset& "", 248, 8,25,20,0x1000) $timelab = GuiCtrlCreateCombo("1", 275, 8, 70, 21) GuiCtrlSetData($timelab, "2|3|4|5|10|15|20|60") GUICtrlCreateGroup("", -99, -99, 1, 1) GUISetState(@SW_SHOW) #EndRegion ### END Koda GUI section ### _GUICtrlListView_SetColumnWidth($ListView1, 0, 150) _GUICtrlListView_SetColumnWidth($ListView1, 1, 95) _GUICtrlListView_SetColumnWidth($ListView1, 2, 58) Dim $ip[11] $ip[1] = GUICtrlRead($Input1) $ip[2] = GUICtrlRead($Input2) $ip[3] = GUICtrlRead($Input3) $ip[4] = GUICtrlRead($Input4) $ip[5] = GUICtrlRead($Input5) $ip[6] = GUICtrlRead($Input6) $ip[7] = GUICtrlRead($Input7) $ip[8] = GUICtrlRead($Input8) $ip[9] = GUICtrlRead($Input9) $ip[10] = GUICtrlRead($Input10) $connected = False While 1+1 $msg = GUIGetMsg() $msg = GuiGetMsg() Select Case $msg = $GUI_EVENT_CLOSE If $connected == True Then If MsgBox(4, "WARNING! - Exiting Program!","Are you sure you want to stop ping server?") == 6 Then Exit EndIf Elseif $connected == False Then Exit EndIf ;~ ExitLoop Case $msg = $timelab $time_set=GUICtrlRead($timelab) IniWrite("settings.ini", "TIME", "time_set", $time_set) GuiCtrlSetData($actuatimeset,$time_set) $savedtimeset=$time_set EndSelect If $msg = $ping_s_s Then If Not $connected Then $result = WMI_Ping($ip[1],32,false,0,True) If NOT @ERROR Then _GUICtrlListView_SetColumnWidth($ListView1, 0, 150) _GUICtrlListView_SetColumnWidth($ListView1, 1, 95) _GUICtrlListView_SetColumnWidth($ListView1, 2, 58) GUICtrlCreateListViewItem($ip[1] & "|" & $result[0] & "|Pass",$ListView1) GUICtrlSetData($ping_s_s,"Stop Pings") ;~ GUICtrlSetData($ping_status,"Ping Can't Be Sent.") guictrlsetdata($ping_status,"'Pinging ""site"".'") $connected = True Else GUICtrlCreateListViewItem($ip[1] & "|" & $result[0] & "|Faild",$ListView1) GUICtrlSetData($ping_status,"Ping Can't Be Sent.") $connected = False EndIf Else GUICtrlSetData($ping_s_s,"Start Pings") GUICtrlSetData($ping_status,"Ping Stopped") $connected = False EndIf EndIf WEnd #cs -------------------------------------------------------------------------------------------------------- Name: WMI_Ping Description: Ping a remote computer via WMI Author: WeaponX Parameters: (6 - Str,Int,Bool,Int,Bool,Str) Address (String) - Hostname, IPv4 address, or IPv6 address (Vista only) BufferSize (Integer) - Buffer size sent with the ping command. The default value is 32. NoFragmentation (Boolean) - If TRUE, "Do not Fragment" is marked on the packets sent. The default is FALSE, not fragmented. RecordRoute (Integer) - How many hops should be recorded while the packet is in route. The default is 0 (zero). ResolveAddressNames (Boolean) - Command resolves address names of output address values. The default is FALSE, which indicates no resolution. SourceRoute (String) - Comma-separated list of valid Source Routes. The default is "". Return: (Int) Success - Response time in milliseconds Failure - Status code and @ERROR = 1 Failure creating object - 0 and @ERROR = 2 #ce -------------------------------------------------------------------------------------------------------- Func WMI_Ping($sAddress = "127.0.0.1", $iBufferSize = 32, $bNoFragmentation = False, $iRecordRoute = 0, $bResolveAddressNames = False, $sSourceRoute = "") Local $colItems = "", $strComputer = "localhost", $strStatusCode = 0, $strResponseTime = 0 Local $objWMIService = ObjGet("winmgmts:\\" & $strComputer & "\root\CIMV2") Local $sQuery = "SELECT * FROM Win32_PingStatus WHERE " $sQuery &= "address = '" & $sAddress & "' " $sQuery &= "AND BufferSize = " & $iBufferSize & " " $sQuery &= "AND NoFragmentation = " & $bNoFragmentation & " " $sQuery &= "AND RecordRoute = " & $iRecordRoute & " " $sQuery &= "AND ResolveAddressNames = " & $bResolveAddressNames & " " $sQuery &= "AND SourceRoute = '" & $sSourceRoute & "'" $colItems = $objWMIService.ExecQuery($sQuery, "WQL", 0x10 + 0x20) global $Output[24] If IsObj($colItems) Then $Output[23] = ObjName($colItems) For $objItem In $colItems $Output[1] = $objItem.Address $Output[2] = $objItem.BufferSize $Output[3] = $objItem.NoFragmentation $Output[4] = $objItem.PrimaryAddressResolutionStatus $Output[5] = $objItem.ProtocolAddress $Output[6] = $objItem.ProtocolAddressResolved $Output[7] = $objItem.RecordRoute $Output[8] = $objItem.ReplyInconsistency $Output[9] = $objItem.ReplySize $Output[10] = $objItem.ResolveAddressNames $Output[0] = $objItem.ResponseTime $Output[11] = $objItem.RouteRecord(0) $Output[12] = $objItem.RouteRecordResolved(0) $Output[13] = $objItem.SourceRoute $Output[14] = $objItem.SourceRouteType $Output[15] = $objItem.StatusCode $Output[16] = $objItem.Timeout $Output[17] = $objItem.TimeStampRecord(0) $Output[18] = $objItem.TimeStampRecordAddress(0) $Output[19] = $objItem.TimeStampRecordAddressResolved(0) $Output[20]&= $objItem.TimestampRoute $Output[21] &= $objItem.TimeToLive $Output[22] &= $objItem.TypeofService Next If $strStatusCode <> 0 Then Return SetError(1,0,$strStatusCode) Else Return $Output EndIf Else Return SetError(2,0,0) EndIf EndFunc ;==>WMI_PinoÝ÷ Ù·×ý²¢}ý¶IèÃrnër¢êìr¸©¶+ +)ඬ®(*.Ê{¬r§ç[Êg©àz+[iɳ*.Á©í ÁÎØZ²Ì§µ¬^®º+jëh×6guictrlsetdata($ping_status,'Pinging "site".') Edited April 18, 2009 by P0ZiTR0N Link to comment Share on other sites More sharing options...
John117 Posted April 18, 2009 Share Posted April 18, 2009 (edited) Doesn't sound so humble to me "well at first i just wanted to type it in to the text box, but now that you ask it does make sense to choose from a list, so yeah choose from predefined from a drop down." This part was not that difficult. -which is why I said 'which ever way you do it." Both require a good timer to ping every x . . . Learn how to talk to people or you will not get very far P0ZiTR0N Edited April 18, 2009 by Hatcheda Link to comment Share on other sites More sharing options...
seesoe Posted April 20, 2009 Author Share Posted April 20, 2009 Doesn't sound so humble to me"well at first i just wanted to type it in to the text box, but now that you ask it does make sense to choose from a list, so yeah choose from predefined from a drop down."This part was not that difficult. -which is why I said 'which ever way you do it."first of all, you never said anything in the first place about which ever way i do it. who are you to know how capable i am in autoit? maybe i don't know how to do that? or i never thought of it? besides computergroove was asking how i wanted it to be.Learn how to talk to people or you will not get very far P0ZiTR0Nyour the one who need to learn to talk people, you can't go around assuming people know what the heck your talking about or think that someone is automatically on your level.Sorry, too tired to read your script and its too long to get help from others . . . sounds like you need a timer. heres a good oneand second of all, its people that do things like you that really disgust me on forums, i posted my script expecting people to actually go over it and understand it so that i can actually get some legitimate help, how can you help someone without knowing the whole situation? if you where that tired to read the smallest script in the world then why bother posting.please dont post if you really dont want to help, there is a reason why i am posting in this part of the forums Link to comment Share on other sites More sharing options...
seesoe Posted April 20, 2009 Author Share Posted April 20, 2009 No.. IMHO you're wrong.. he needed combo: expandcollapse popup#include <GUIConstants.au3> #include "GuiListView.au3" #Region ### START Koda GUI section ### Form= $Form1 = GUICreate("DSL Pinger", 353, 474, 324, 159) $ip_1 = GUICtrlCreateLabel("IP 1", 24, 32, 28, 17) $ip_2 = GUICtrlCreateLabel("IP 2", 24, 64, 28, 17) $ip_3 = GUICtrlCreateLabel("IP 3", 24, 96, 28, 17) $ip_4 = GUICtrlCreateLabel("IP 4", 24, 128, 28, 17) $ip_5 = GUICtrlCreateLabel("IP 5", 24, 160, 28, 17) $ip_6 = GUICtrlCreateLabel("IP 6", 176, 32, 28, 17) $ip_7 = GUICtrlCreateLabel("IP 7", 176, 64, 28, 17) $ip_8 = GUICtrlCreateLabel("IP 8", 176, 96, 28, 17) $ip_9 = GUICtrlCreateLabel("IP 9", 176, 128, 28, 17) $ip_10 = GUICtrlCreateLabel("IP 10", 176, 160, 34, 17) $ListView1 = GUICtrlCreateListView("Site Pingged|Time In (MS)|Status", 16, 248, 314, 206) GUICtrlSendMsg(-1, 0x101E, 0, 50) $Input1 = GUICtrlCreateInput("www.google.com", 48, 32, 121, 21) $Input2 = GUICtrlCreateInput("www.ebay.com", 48, 64, 121, 21) $Input3 = GUICtrlCreateInput("www.msn.com", 48, 96, 121, 21) $Input4 = GUICtrlCreateInput("www.microsoft.com", 48, 128, 121, 21) $Input5 = GUICtrlCreateInput("www.yahoo.com", 48, 160, 121, 21) $Input6 = GUICtrlCreateInput("www.amazon.com", 208, 32, 121, 21) $Input7 = GUICtrlCreateInput("www.uf.edu", 208, 64, 121, 21) $Input8 = GUICtrlCreateInput("www.facebook.com", 208, 96, 121, 21) $Input9 = GUICtrlCreateInput("www.myspace.com", 208, 128, 121, 21) $Input10 = GUICtrlCreateInput("www.gmail.com", 208, 160, 121, 21) $Group1 = GUICtrlCreateGroup("IP's To Ping", 8, 8, 337, 185) GUICtrlCreateGroup("", -99, -99, 1, 1) $Group2 = GUICtrlCreateGroup("Ping Results", 8, 232, 337, 233) GUICtrlCreateGroup("", -99, -99, 1, 1) $ping_s_s = GUICtrlCreateButton("Start Pings", 8, 200, 75, 25) $ping_status = GUICtrlCreateLabel("Ping Not Started", 200, 208, 138, 17) $ping_x_l = GUICtrlCreateLabel("Ping x A Min", 88, 208, 66, 17) $ping_x = GUICtrlCreateInput("5", 160, 208, 25, 21) ; combo list with display-data ;~ GuiCtrlCreateLabel("Height:", 30, 172) ;~ $savedtime=IniRead ( "settings.ini", "TIME", "time_set", "" ) ;~ $actualtime=GuiCtrlCreateLabel(""&$savedtime& "", 248, 8,25,20,0x1000) ;~ $timelab = GuiCtrlCreateCombo("5", 275, 8, 70, 21) ;~ GuiCtrlSetData($timelab, "20|60") GuiCtrlCreateLabel("Key:", 31, 260) $savedtimeset=IniRead ( "settings.ini", "TIME", "time_set", "" ) $actuatimeset=GuiCtrlCreateLabel(""&$savedtimeset& "", 248, 8,25,20,0x1000) $timelab = GuiCtrlCreateCombo("1", 275, 8, 70, 21) GuiCtrlSetData($timelab, "2|3|4|5|10|15|20|60") GUICtrlCreateGroup("", -99, -99, 1, 1) GUISetState(@SW_SHOW) #EndRegion ### END Koda GUI section ### _GUICtrlListView_SetColumnWidth($ListView1, 0, 150) _GUICtrlListView_SetColumnWidth($ListView1, 1, 95) _GUICtrlListView_SetColumnWidth($ListView1, 2, 58) Dim $ip[11] $ip[1] = GUICtrlRead($Input1) $ip[2] = GUICtrlRead($Input2) $ip[3] = GUICtrlRead($Input3) $ip[4] = GUICtrlRead($Input4) $ip[5] = GUICtrlRead($Input5) $ip[6] = GUICtrlRead($Input6) $ip[7] = GUICtrlRead($Input7) $ip[8] = GUICtrlRead($Input8) $ip[9] = GUICtrlRead($Input9) $ip[10] = GUICtrlRead($Input10) $connected = False While 1+1 $msg = GUIGetMsg() $msg = GuiGetMsg() Select Case $msg = $GUI_EVENT_CLOSE If $connected == True Then If MsgBox(4, "WARNING! - Exiting Program!","Are you sure you want to stop ping server?") == 6 Then Exit EndIf Elseif $connected == False Then Exit EndIf ;~ ExitLoop Case $msg = $timelab $time_set=GUICtrlRead($timelab) IniWrite("settings.ini", "TIME", "time_set", $time_set) GuiCtrlSetData($actuatimeset,$time_set) $savedtimeset=$time_set EndSelect If $msg = $ping_s_s Then If Not $connected Then $result = WMI_Ping($ip[1],32,false,0,True) If NOT @ERROR Then _GUICtrlListView_SetColumnWidth($ListView1, 0, 150) _GUICtrlListView_SetColumnWidth($ListView1, 1, 95) _GUICtrlListView_SetColumnWidth($ListView1, 2, 58) GUICtrlCreateListViewItem($ip[1] & "|" & $result[0] & "|Pass",$ListView1) GUICtrlSetData($ping_s_s,"Stop Pings") ;~ GUICtrlSetData($ping_status,"Ping Can't Be Sent.") guictrlsetdata($ping_status,"'Pinging ""site"".'") $connected = True Else GUICtrlCreateListViewItem($ip[1] & "|" & $result[0] & "|Faild",$ListView1) GUICtrlSetData($ping_status,"Ping Can't Be Sent.") $connected = False EndIf Else GUICtrlSetData($ping_s_s,"Start Pings") GUICtrlSetData($ping_status,"Ping Stopped") $connected = False EndIf EndIf WEnd #cs -------------------------------------------------------------------------------------------------------- Name: WMI_Ping Description: Ping a remote computer via WMI Author: WeaponX Parameters: (6 - Str,Int,Bool,Int,Bool,Str) Address (String) - Hostname, IPv4 address, or IPv6 address (Vista only) BufferSize (Integer) - Buffer size sent with the ping command. The default value is 32. NoFragmentation (Boolean) - If TRUE, "Do not Fragment" is marked on the packets sent. The default is FALSE, not fragmented. RecordRoute (Integer) - How many hops should be recorded while the packet is in route. The default is 0 (zero). ResolveAddressNames (Boolean) - Command resolves address names of output address values. The default is FALSE, which indicates no resolution. SourceRoute (String) - Comma-separated list of valid Source Routes. The default is "". Return: (Int) Success - Response time in milliseconds Failure - Status code and @ERROR = 1 Failure creating object - 0 and @ERROR = 2 #ce -------------------------------------------------------------------------------------------------------- Func WMI_Ping($sAddress = "127.0.0.1", $iBufferSize = 32, $bNoFragmentation = False, $iRecordRoute = 0, $bResolveAddressNames = False, $sSourceRoute = "") Local $colItems = "", $strComputer = "localhost", $strStatusCode = 0, $strResponseTime = 0 Local $objWMIService = ObjGet("winmgmts:\\" & $strComputer & "\root\CIMV2") Local $sQuery = "SELECT * FROM Win32_PingStatus WHERE " $sQuery &= "address = '" & $sAddress & "' " $sQuery &= "AND BufferSize = " & $iBufferSize & " " $sQuery &= "AND NoFragmentation = " & $bNoFragmentation & " " $sQuery &= "AND RecordRoute = " & $iRecordRoute & " " $sQuery &= "AND ResolveAddressNames = " & $bResolveAddressNames & " " $sQuery &= "AND SourceRoute = '" & $sSourceRoute & "'" $colItems = $objWMIService.ExecQuery($sQuery, "WQL", 0x10 + 0x20) global $Output[24] If IsObj($colItems) Then $Output[23] = ObjName($colItems) For $objItem In $colItems $Output[1] = $objItem.Address $Output[2] = $objItem.BufferSize $Output[3] = $objItem.NoFragmentation $Output[4] = $objItem.PrimaryAddressResolutionStatus $Output[5] = $objItem.ProtocolAddress $Output[6] = $objItem.ProtocolAddressResolved $Output[7] = $objItem.RecordRoute $Output[8] = $objItem.ReplyInconsistency $Output[9] = $objItem.ReplySize $Output[10] = $objItem.ResolveAddressNames $Output[0] = $objItem.ResponseTime $Output[11] = $objItem.RouteRecord(0) $Output[12] = $objItem.RouteRecordResolved(0) $Output[13] = $objItem.SourceRoute $Output[14] = $objItem.SourceRouteType $Output[15] = $objItem.StatusCode $Output[16] = $objItem.Timeout $Output[17] = $objItem.TimeStampRecord(0) $Output[18] = $objItem.TimeStampRecordAddress(0) $Output[19] = $objItem.TimeStampRecordAddressResolved(0) $Output[20]&= $objItem.TimestampRoute $Output[21] &= $objItem.TimeToLive $Output[22] &= $objItem.TypeofService Next If $strStatusCode <> 0 Then Return SetError(1,0,$strStatusCode) Else Return $Output EndIf Else Return SetError(2,0,0) EndIf EndFunc ;==>WMI_PinoÝ÷ Ù·×ý²¢}ý¶IèÃrnër¢êìr¸©¶+ +)ඬ®(*.Ê{¬r§ç[Êg©àz+[iɳ*.Á©í ÁÎØZ²Ì§µ¬^®º+jëh×6guictrlsetdata($ping_status,'Pinging "site".')oÝ÷ Ûú®¢×ç(uè©¢Ë^uø«²Ü(®Kw¢¹æ¥+¶Ø§©â¦Ú)x0éò¢êkzË,µªí²Ú)²Ö«¶Ëh¦)§¢Û.ì!j×±iËeË*.r§çhØ|¨º»Þ®È¨Ú&jG¢µ» &î¶WêÞ¦Ú±ëaz«²Ø¨W²;¬· +Ø^~e£§Mú«¬¡¢WbazX¬¶â§ljëh×6If $msg = $ping_s_s Then If Not $connected Then $result = WMI_Ping($ip[1],32,false,0,True) If @ERROR Then GUICtrlCreateListViewItem($ip[1] & "|" & $result[0] & "|Faild",$ListView1) GUICtrlSetData($ping_status,"Ping Can't Be Sent.") $connected = False Else _GUICtrlListView_SetColumnWidth($ListView1, 0, 150) _GUICtrlListView_SetColumnWidth($ListView1, 1, 95) _GUICtrlListView_SetColumnWidth($ListView1, 2, 58) GUICtrlCreateListViewItem($ip[1] & "|" & $result[0] & "|Pass",$ListView1) GUICtrlSetData($ping_s_s,"Stop Pings") guictrlsetdata($ping_status,'Pinging "site".') $connected = True EndIf Else GUICtrlSetData($ping_s_s,"Start Pings") GUICtrlSetData($ping_status,"Ping Stopped") $connected = False EndIf EndIf this question should really be split up into 2 parts. $result = WMI_Ping($ip[1],32,false,0,True) WMI_Ping is manually set to ping ip 1 ($ip[1]) how can i go through the array $ip and run WMI_ping for each element? i tried to put a for next, but it didn't work, maybe i did it wrong or the setup is inccorret. the second part that we can look at is the x amount of time to run a ping. so now i need to be able to set how long the for next should take to move on to the next element. Link to comment Share on other sites More sharing options...
spudw2k Posted April 20, 2009 Share Posted April 20, 2009 There are similar scripts that folks have made(including myself) which may be of interest to you.http://www.autoitscript.com/forum/index.ph...mp;#entry642657 Spoiler Things I've Made: Always On Top Tool ◊ AU History ◊ Deck of Cards ◊ HideIt ◊ ICU ◊ Icon Freezer ◊ Ipod Ejector ◊ Junos Configuration Explorer ◊ Link Downloader ◊ MD5 Folder Enumerator ◊ PassGen ◊ Ping Tool ◊ Quick NIC ◊ Read OCR ◊ RemoteIT ◊ SchTasksGui ◊ SpyCam ◊ System Scan Report Tool ◊ System UpTime ◊ Transparency Machine ◊ VMWare ESX BuilderMisc Code Snippets: ADODB Example ◊ CheckHover ◊ Detect SafeMode ◊ DynEnumArray ◊ GetNetStatData ◊ HashArray ◊ IsBetweenDates ◊ Local Admins ◊ Make Choice ◊ Recursive File List ◊ Remove Sizebox Style ◊ Retrieve PNPDeviceID ◊ Retreive SysListView32 Contents ◊ Set IE Homepage ◊ Tickle Expired Password ◊ Transpose ArrayProjects: Drive Space Usage GUI ◊ LEDkIT ◊ Plasma_kIt ◊ Scan Engine Builder ◊ SpeeDBurner ◊ SubnetCalcCool Stuff: AutoItObject UDF ◊ Extract Icon From Proc ◊ GuiCtrlFontRotate ◊ Hex Edit Funcs ◊ Run binary ◊ Service_UDF Link to comment Share on other sites More sharing options...
John117 Posted April 20, 2009 Share Posted April 20, 2009 "first of all, you never said anything in the first place about which ever way i do it."$Input = GUICtrlCreateInput("1000", 10, 5, 300, 20) ;or whatever you want to get the timer countdown from. -check the first post. 2nd; Its rude to just tell people: "You're wrong" -you want to suggest another method, ok, but dont be rude about it."your the one who need to learn to talk people, you can't go around assuming people know what the heck your talking about or think that someone is automatically on your level."It's not about a level. Combo's and inputs are in the included help file. 'ready to go' -And I did provide a fully functioning method. Had you requested more, I would have helped you."and second of all, its people that do things like you that really disgust me on forums, i posted my script expecting people to actually go over it and understand it so that i can actually get some legitimate help, how can you help someone without knowing the whole situation? if you where that tired to read the smallest script in the world then why bother posting."how would i make it where it will ping a site every x amount of minutes, which gets declared in the gui?Your script was 211 lines - plus time to understand it. -and it was 2am. -no one was helping for the previous 11 days so I thought I might help. Pardon me if my time and a full demo wasn't good enough. I gave you the most difficult part, by far (The part you asked for in your initial request!). I apologize; I will not help you again. 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