November Posted June 5, 2007 Author Share Posted June 5, 2007 Hi there... I'm not a great teacher... and i dont understand a lot of array cause i always hate maths But if you want a 2D array you got to say how many dimensions you want: i beliave this is a cool example to understand : Dim $myArray[10][20] ;element 0,0 to 9,19 $rows = UBound($myArray) $cols = UBound($myArray, 2) $dims = UBound($myArray, 0) MsgBox(0, "The " & $dims & "-dimensional array has", _ $rows & " rows, " & $cols & " columns") ;Display $myArray's contents $output = "" For $r = 0 to UBound($myArray,1) - 1 $output = $output & @LF For $c = 0 to UBound($myArray,2) - 1 $output = $output & $myArray[$r][$c] & " " Next Next MsgBox(4096,"Array Contents", $output) Nevertheless if you need help, just post it in the General Help and Support forum. Me and other will help you with pleasure! Cheers m8... keep on scripting Old Scriptology Visual Ping 1.8 - Mass Ping Program with export to txt delimited. Desktop 2 RGB and YMCK - Pick a color in the desktop and get the RGB and YMCK code. Desktop 2 RGB - Pick a color in the desktop and get the RGB code. ShootIT 1.0 - Screen Capture full and partial screen [font="'Arial Black';"]Remember Remember The Fifth of November.[/font] Link to comment Share on other sites More sharing options...
bowain Posted June 5, 2007 Share Posted June 5, 2007 Hi there... I'm not a great teacher... and i dont understand a lot of array cause i always hate maths But if you want a 2D array you got to say how many dimensions you want: i beliave this is a cool example to understand : Dim $myArray[10][20] ;element 0,0 to 9,19 $rows = UBound($myArray) $cols = UBound($myArray, 2) $dims = UBound($myArray, 0) MsgBox(0, "The " & $dims & "-dimensional array has", _ $rows & " rows, " & $cols & " columns") ;Display $myArray's contents $output = "" For $r = 0 to UBound($myArray,1) - 1 $output = $output & @LF For $c = 0 to UBound($myArray,2) - 1 $output = $output & $myArray[$r][$c] & " " Next Next MsgBox(4096,"Array Contents", $output) Nevertheless if you need help, just post it in the General Help and Support forum. Me and other will help you with pleasure! Cheers m8... keep on scripting Thanks this'll get me started. ya, I know I should have posted in general help and support with the question. I was just getting my feet wet with your script and was coming back to multi-dimmed arrays later. Your example for arrays may be all I need for now. Link to comment Share on other sites More sharing options...
November Posted June 6, 2007 Author Share Posted June 6, 2007 Thanks this'll get me started.ya, I know I should have posted in general help and support with the question. I was just getting my feet wet with your script and was coming back to multi-dimmed arrays later. Your example for arrays may be all I need for now.Ok m8... Glad i could help you!Cheers and have a nice scripting day Old Scriptology Visual Ping 1.8 - Mass Ping Program with export to txt delimited. Desktop 2 RGB and YMCK - Pick a color in the desktop and get the RGB and YMCK code. Desktop 2 RGB - Pick a color in the desktop and get the RGB code. ShootIT 1.0 - Screen Capture full and partial screen [font="'Arial Black';"]Remember Remember The Fifth of November.[/font] Link to comment Share on other sites More sharing options...
kman Posted July 10, 2007 Share Posted July 10, 2007 November, this is a very nice program and something I would like to use but wondering if you or someone could help me modify it for what Im looking for. Is there a way to have the host file preloaded or included in the script? Im looking to make it as simple for a user as possible and have them just be able to scan what is already set for them without giving them the option of importing and exporting? Thanks for any help!! Link to comment Share on other sites More sharing options...
Aces Posted July 10, 2007 Share Posted July 10, 2007 kman you're lazy haha ~~ AutoIt v3 Minion ~~Name: Kevin "Aces-X" MorrisOrganization: A C DevelopmentE-Mail: AcesX91@acecoding.netOS: XP Professional; Vista package~~ Released Software ~~CPU-Mach: Topic at acecoding.net ForumsProxyzBuddy: Beta testing at the moment, private onlyWHSTool: Not released to the public Link to comment Share on other sites More sharing options...
Kiesp Posted July 11, 2007 Share Posted July 11, 2007 (edited) for people running vista (as myself cuz i dont have a choice atm) u should add theese lines case $OSVersion = "WIN_VISTA" $iconexit = "27" $iconscan = "22" $iconhelp = "23" $iconfile = "70" $iconexport = "6" in the select part of the script nice program btw EDIT: or just add ' or "WIN_VISTA" ' on line 55 ^^ Edited July 11, 2007 by Kiesp http://www.autoitscript.com/forum/index.php?showtopic=69911 <-- Best hacker ever :D Link to comment Share on other sites More sharing options...
kman Posted July 11, 2007 Share Posted July 11, 2007 Thanks for the constructive help aces. Its too bad we are all not as skilled as you to leave worthless comments. Im just looking for a little help to point me in the right direction. Link to comment Share on other sites More sharing options...
November Posted July 13, 2007 Author Share Posted July 13, 2007 (edited) November, this is a very nice program and something I would like to use but wondering if you or someone could help me modify it for what Im looking for. Is there a way to have the host file preloaded or included in the script? Im looking to make it as simple for a user as possible and have them just be able to scan what is already set for them without giving them the option of importing and exporting? Thanks for any help!!Hi there... sure there is :Remove the host file button, include a hostfile and in file func use that hostfile! Cheers m8 Edited July 13, 2007 by november Old Scriptology Visual Ping 1.8 - Mass Ping Program with export to txt delimited. Desktop 2 RGB and YMCK - Pick a color in the desktop and get the RGB and YMCK code. Desktop 2 RGB - Pick a color in the desktop and get the RGB code. ShootIT 1.0 - Screen Capture full and partial screen [font="'Arial Black';"]Remember Remember The Fifth of November.[/font] Link to comment Share on other sites More sharing options...
kman Posted July 13, 2007 Share Posted July 13, 2007 (edited) Thank you November! I have been slowly heading that way. Here is what I have currently, but right now the screen flickers or keeps loading the host file. I will keep working on this but would appreciate any help. Thank you! CODE#cs ---------------------------------------------------------------------------- AutoIt Version: 3.2.2.0 Author: November Date: 2007, March 02 Script Function: Script ping loop with dynamic hosts #ce ---------------------------------------------------------------------------- ; Start Script ;Includes #include <GuiListView.au3> #include <GUIConstants.au3> #include <GuiList.au3> #include <GuiTreeView.au3> #include <file.au3> #include <array.au3> ;Options ;Opt ("GUICloseOnESC", 1) Opt ("TCPTimeout", 10) Opt("TrayIconHide", 1) Opt("TrayAutoPause", 0) Opt("GUIResizeMode", 1) Opt("GUIOnEventMode", 0) ;Hotkeys HotKeySet("{ESC}", "exity") ;Declaration Dim $listview, $totalservers, $ping, $msg, $aRecords, $x, $exitB, $index, $item, $round, $Progress, $value, $FileHost, $host, $totalservers, $repeat, $stop, $gui, $errorhost, $HelpB, $teste, $nametoip, $location, $name, $tempfile, $exitHB, $decision ;inicial declarations $host = 0;Grants no hostfile in the beginning $scan = 0; Grants no Scna was made for correct file export ;GUI creation $osversion = @OSVersion;Organizes the images for the buttons for w2k and winxp select case $OSVersion = "WIN_2000" $iconexit = "105" $iconscan = "55" $iconhelp = "23" $iconfile = "70" $iconexport = "6" case $OSVersion = "WIN_XP" $iconexit = "27" $iconscan = "22" $iconhelp = "23" $iconfile = "70" $iconexport = "6" EndSelect $gui = GUICreate("Visual Ping - Version 1.7", 450, 375, @DesktopHeight/2-120, @DesktopWidth/2-380, $WS_VISIBLE + $WS_CLIPSIBLINGS + $LVS_EX_GRIDLINES) ;, $LVS_EX_GRIDLINES and $LVS_EX_GRIDLINES $progress = GUICtrlCreateProgress (20, 250, 150, 15); $PBS_SMOOTH $listview = GUICtrlCreateListView(" Server Name | Server Status | IP Address ", 15, 20, 415, 210, $LVS_EX_HEADERDRAGDROP) ;$FileHost = GUICtrlCreateButton("Host File", 245, 263, 45, 45, $BS_ICON,$BS_DEFPUSHBUTTON) $repeat = GUICtrlCreateButton("Scan Hosts", 290, 263, 45, 45, $BS_ICON,$BS_DEFPUSHBUTTON) $exitB = GUICtrlCreateButton("Exit Program", 335, 263, 45, 45, $BS_ICON,$BS_DEFPUSHBUTTON) $HelpB = GUICtrlCreateButton("Help", 380, 263, 45, 45, $BS_ICON,$BS_DEFPUSHBUTTON) ;GUICtrlCreateLabel( "HOSTS", 250, 310, 50, 15) GUICtrlCreateLabel( "SCAN", 290, 310, 50, 15) GUICtrlCreateLabel( "EXIT", 345, 310, 50, 15) GUICtrlCreateLabel( "HELP", 385, 310, 50, 15) ;GUI Style GUICtrlSetImage ($repeat, "shell32.dll",$iconscan) ;GUICtrlSetImage ($FileHost, "shell32.dll",$iconfile) GUICtrlSetImage ($exitB, "shell32.dll",$iconexit) GUICtrlSetImage ($HelpB, "shell32.dll",$iconhelp) GUICtrlCreateLabel( "OVERALL : ", 20, 270, 65, 15, $SS_SUNKEN, $SS_WHITERECT) GUICtrlCreateLabel( "", 85, 270, 50, 15, $SS_SUNKEN ) GUICtrlCreateLabel( "TOTAL HOSTS: ", 20, 290, 115, 15, $SS_SUNKEN ) GUISetFont(9, 400, 2, "Monotype Corsiva") GUISetFont(9, 400, "", "") ;Read GUI GUISetState() ;Selection Loop While 1 $msg = GUIGetMsg() Select Case $msg = $GUI_EVENT_CLOSE exity() Case $msg = $exitB exity() Case $msg = $repeat prerepeat() Case $msg = $FileHost file() Case $msg = $helpb help() EndSelect Wend ;funcs func prerepeat();Checks if host file is loaded if not $host = 0 Then repeat() ;Return Else $errorhost = GUICtrlCreateLabel( "ERROR : HOST FILE NOT LOADED", 45, 325, 350, 15, $SS_SUNKEN) GUICtrlSetColor($errorhost, 0xff0000) return EndIf EndFunc Func repeat();Ping the Host File $name = "EXPORTDAY" & @YEAR & @WDAY & @HOUR & @MIN & @SEC & ".TXT" $tempfile = _FileCreate(@TempDir & "\" & $name) FileWriteLine(@TempDir & "\" & $name, "SERVER,STATUS,IP" & @CRLF) TCPStartup() _GUICtrlListViewDeleteAllItems ( $listview ) $teste = UBound ( $aRecords )-1 for $x = 1 to $teste $errorhost = GUICtrlCreateLabel( "Scanning : " & $aRecords[$x], 45, 325, 350, 15, $SS_SUNKEN) $ping = ping($aRecords[$x], 2) $nametoip = TCPNameToIP($aRecords[$x]) if $nametoip = "" Then $nametoip = "NO IP AVAILABLE" EndIf if $ping Then $ping = "ONLINE" $item = GUICtrlCreateListViewItem($aRecords[$x] & "|" & $ping & "|" & $nametoip, $listview) GUICtrlSetColor($item, 0x3cb371) Else $ping = "OFFLINE" $item = GUICtrlCreateListViewItem($aRecords[$x] & "|" & $ping & "|" & $nametoip, $listview) GUICtrlSetColor($item, 0xff0000) EndIf FileWriteLine(@TempDir & "\" & $name, $aRecords[$x] & "," & $ping & "," & $nametoip & @CRLF) $value = Number($x*100/$totalservers) $round = round($value) GUICtrlCreateLabel( "OVERALL : ", 20, 270, 65, 15, $SS_SUNKEN ) GUICtrlCreateLabel( " " & $round & " %", 85, 270, 50, 15, $SS_SUNKEN ) GUICtrlCreateLabel( "TOTAL HOSTS: " & $totalservers, 20, 290, 115, 15, $SS_SUNKEN ) GUICtrlSetData($progress, $round) Next $errorhost = GUICtrlCreateLabel( "SCAN COMPLETED", 45, 325, 350, 15, $SS_SUNKEN) GUICtrlSetColor($errorhost, 0x3cb371) TCPShutdown() $scan = 1 EndFunc Func file();Opens Host File and removes empty lines $host = _FileReadToArray("C:\Documents and Settings\User\Desktop\ping.txt",$aRecords) if @error = 1 Then $host = 0 Return EndIf while 0 $newvar = _ArraySearch($aRecords, "", 0, 0, 0, false) if @error = 6 Then ExitLoop Else _ArrayDelete($aRecords, $newvar) EndIf wend $totalservers = UBound ( $aRecords )-1 $errorhost = GUICtrlCreateLabel( "HOST FILE LOADED", 45, 325, 350, 15, $SS_SUNKEN) GUICtrlCreateLabel( "TOTAL HOSTS: " & $totalservers, 20, 290, 115, 15, $SS_SUNKEN ) GUICtrlSetColor($errorhost, 0x3cb371) Return EndFunc Func help();Brings the Help Box $helpgui = GUICreate("Visual Ping - HELP", 220, 175, @DesktopHeight/2, @DesktopWidth/2-250, $WS_CAPTION + $WS_SYSMENU) $help = GUICtrlCreateLabel("Visual Ping - Version 1.7" & @LF & @LF & "Simple program to ping hosts" & @LF & "Text file export" & @LF & "" & @LF & "November 2007" & @LF & "Designed for Free Use", 20, 10) $exitHB = GUICtrlCreateButton("Exit Program", 85, 120, 45, 45, $BS_ICON,$BS_DEFPUSHBUTTON) GUICtrlSetImage ($exitHB, "shell32.dll",$iconexit, 0) GUISetState() while 1 $decision = GUIGetMsg() Select Case $decision = $GUI_EVENT_CLOSE GUIDelete($helpgui) Return Case $decision = $exitHB GUIDelete($helpgui) Return EndSelect wend EndFunc Func exity();Exit Program FileDelete(@TempDir & "\" & $name) exit EndFunc ;Fim de script Edited July 13, 2007 by kman Link to comment Share on other sites More sharing options...
November Posted July 13, 2007 Author Share Posted July 13, 2007 Thank you November! I have been slowly heading that way. Here is what I have currently, but right now the screen flickers or keeps loading the host file and looks to be pinging the local pc that is not included in the host file. I will keep working on this but would appreciate any help. Thank you! CODE#cs ---------------------------------------------------------------------------- AutoIt Version: 3.2.2.0 Author: November Date: 2007, March 02 Script Function: Script ping loop with dynamic hosts #ce ---------------------------------------------------------------------------- ; Start Script ;Includes #include <GuiListView.au3> #include <GUIConstants.au3> #include <GuiList.au3> #include <GuiTreeView.au3> #include <file.au3> #include <array.au3> ;Options ;Opt ("GUICloseOnESC", 1) Opt ("TCPTimeout", 10) Opt("TrayIconHide", 1) Opt("TrayAutoPause", 0) Opt("GUIResizeMode", 1) Opt("GUIOnEventMode", 0) ;Hotkeys HotKeySet("{ESC}", "exity") ;Declaration Dim $listview, $totalservers, $ping, $msg, $aRecords, $x, $exitB, $index, $item, $round, $Progress, $value, $FileHost, $host, $totalservers, $repeat, $stop, $gui, $errorhost, $HelpB, $teste, $nametoip, $location, $name, $tempfile, $exitHB, $decision ;inicial declarations $host = 0;Grants no hostfile in the beginning $scan = 0; Grants no Scna was made for correct file export ;GUI creation $osversion = @OSVersion;Organizes the images for the buttons for w2k and winxp select case $OSVersion = "WIN_2000" $iconexit = "105" $iconscan = "55" $iconhelp = "23" $iconfile = "70" $iconexport = "6" case $OSVersion = "WIN_XP" $iconexit = "27" $iconscan = "22" $iconhelp = "23" $iconfile = "70" $iconexport = "6" EndSelect $gui = GUICreate("Visual Ping - Version 1.7", 450, 375, @DesktopHeight/2-120, @DesktopWidth/2-380, $WS_VISIBLE + $WS_CLIPSIBLINGS + $LVS_EX_GRIDLINES) ;, $LVS_EX_GRIDLINES and $LVS_EX_GRIDLINES $progress = GUICtrlCreateProgress (20, 250, 150, 15); $PBS_SMOOTH $listview = GUICtrlCreateListView(" Server Name | Server Status | IP Address ", 15, 20, 415, 210, $LVS_EX_HEADERDRAGDROP) ;$FileHost = GUICtrlCreateButton("Host File", 245, 263, 45, 45, $BS_ICON,$BS_DEFPUSHBUTTON) $repeat = GUICtrlCreateButton("Scan Hosts", 290, 263, 45, 45, $BS_ICON,$BS_DEFPUSHBUTTON) $exitB = GUICtrlCreateButton("Exit Program", 335, 263, 45, 45, $BS_ICON,$BS_DEFPUSHBUTTON) $HelpB = GUICtrlCreateButton("Help", 380, 263, 45, 45, $BS_ICON,$BS_DEFPUSHBUTTON) ;GUICtrlCreateLabel( "HOSTS", 250, 310, 50, 15) GUICtrlCreateLabel( "SCAN", 290, 310, 50, 15) GUICtrlCreateLabel( "EXIT", 345, 310, 50, 15) GUICtrlCreateLabel( "HELP", 385, 310, 50, 15) ;GUI Style GUICtrlSetImage ($repeat, "shell32.dll",$iconscan) ;GUICtrlSetImage ($FileHost, "shell32.dll",$iconfile) GUICtrlSetImage ($exitB, "shell32.dll",$iconexit) GUICtrlSetImage ($HelpB, "shell32.dll",$iconhelp) GUICtrlCreateLabel( "OVERALL : ", 20, 270, 65, 15, $SS_SUNKEN, $SS_WHITERECT) GUICtrlCreateLabel( "", 85, 270, 50, 15, $SS_SUNKEN ) GUICtrlCreateLabel( "TOTAL HOSTS: ", 20, 290, 115, 15, $SS_SUNKEN ) GUISetFont(9, 400, 2, "Monotype Corsiva") GUISetFont(9, 400, "", "") ;Read GUI GUISetState() ;Selection Loop While 1 $msg = GUIGetMsg() Select Case $msg = $GUI_EVENT_CLOSE exity() Case $msg = $exitB exity() Case $msg = $repeat prerepeat() Case $msg = $FileHost file() Case $msg = $helpb help() EndSelect Wend ;funcs func prerepeat();Checks if host file is loaded if not $host = 0 Then repeat() ;Return Else $errorhost = GUICtrlCreateLabel( "ERROR : HOST FILE NOT LOADED", 45, 325, 350, 15, $SS_SUNKEN) GUICtrlSetColor($errorhost, 0xff0000) return EndIf EndFunc Func repeat();Ping the Host File $name = "EXPORTDAY" & @YEAR & @WDAY & @HOUR & @MIN & @SEC & ".TXT" $tempfile = _FileCreate(@TempDir & "\" & $name) FileWriteLine(@TempDir & "\" & $name, "SERVER,STATUS,IP" & @CRLF) TCPStartup() _GUICtrlListViewDeleteAllItems ( $listview ) $teste = UBound ( $aRecords )-1 for $x = 1 to $teste $errorhost = GUICtrlCreateLabel( "Scanning : " & $aRecords[$x], 45, 325, 350, 15, $SS_SUNKEN) $ping = ping($aRecords[$x], 2) $nametoip = TCPNameToIP($aRecords[$x]) if $nametoip = "" Then $nametoip = "NO IP AVAILABLE" EndIf if $ping Then $ping = "ONLINE" $item = GUICtrlCreateListViewItem($aRecords[$x] & "|" & $ping & "|" & $nametoip, $listview) GUICtrlSetColor($item, 0x3cb371) Else $ping = "OFFLINE" $item = GUICtrlCreateListViewItem($aRecords[$x] & "|" & $ping & "|" & $nametoip, $listview) GUICtrlSetColor($item, 0xff0000) EndIf FileWriteLine(@TempDir & "\" & $name, $aRecords[$x] & "," & $ping & "," & $nametoip & @CRLF) $value = Number($x*100/$totalservers) $round = round($value) GUICtrlCreateLabel( "OVERALL : ", 20, 270, 65, 15, $SS_SUNKEN ) GUICtrlCreateLabel( " " & $round & " %", 85, 270, 50, 15, $SS_SUNKEN ) GUICtrlCreateLabel( "TOTAL HOSTS: " & $totalservers, 20, 290, 115, 15, $SS_SUNKEN ) GUICtrlSetData($progress, $round) Next $errorhost = GUICtrlCreateLabel( "SCAN COMPLETED", 45, 325, 350, 15, $SS_SUNKEN) GUICtrlSetColor($errorhost, 0x3cb371) TCPShutdown() $scan = 1 EndFunc Func file();Opens Host File and removes empty lines $host = _FileReadToArray("C:\Documents and Settings\User\Desktop\ping.txt",$aRecords) if @error = 1 Then $host = 0 Return EndIf while 0 $newvar = _ArraySearch($aRecords, "", 0, 0, 0, false) if @error = 6 Then ExitLoop Else _ArrayDelete($aRecords, $newvar) EndIf wend $totalservers = UBound ( $aRecords )-1 $errorhost = GUICtrlCreateLabel( "HOST FILE LOADED", 45, 325, 350, 15, $SS_SUNKEN) GUICtrlCreateLabel( "TOTAL HOSTS: " & $totalservers, 20, 290, 115, 15, $SS_SUNKEN ) GUICtrlSetColor($errorhost, 0x3cb371) Return EndFunc Func help();Brings the Help Box $helpgui = GUICreate("Visual Ping - HELP", 220, 175, @DesktopHeight/2, @DesktopWidth/2-250, $WS_CAPTION + $WS_SYSMENU) $help = GUICtrlCreateLabel("Visual Ping - Version 1.7" & @LF & @LF & "Simple program to ping hosts" & @LF & "Text file export" & @LF & "" & @LF & "November 2007" & @LF & "Designed for Free Use", 20, 10) $exitHB = GUICtrlCreateButton("Exit Program", 85, 120, 45, 45, $BS_ICON,$BS_DEFPUSHBUTTON) GUICtrlSetImage ($exitHB, "shell32.dll",$iconexit, 0) GUISetState() while 1 $decision = GUIGetMsg() Select Case $decision = $GUI_EVENT_CLOSE GUIDelete($helpgui) Return Case $decision = $exitHB GUIDelete($helpgui) Return EndSelect wend EndFunc Func exity();Exit Program FileDelete(@TempDir & "\" & $name) exit EndFunc ;Fim de script Hi there again, When i created this application, i made it regarding the exportation from excel to txt file. like this: server1 workstation1 server2 workstation2 and so on regard that you can have a empty line...the app deletes it. Cheers Old Scriptology Visual Ping 1.8 - Mass Ping Program with export to txt delimited. Desktop 2 RGB and YMCK - Pick a color in the desktop and get the RGB and YMCK code. Desktop 2 RGB - Pick a color in the desktop and get the RGB code. ShootIT 1.0 - Screen Capture full and partial screen [font="'Arial Black';"]Remember Remember The Fifth of November.[/font] Link to comment Share on other sites More sharing options...
kman Posted July 13, 2007 Share Posted July 13, 2007 I think I get that. How do I include the host file? Can I do that with #include? Sorry for the newb questions! Link to comment Share on other sites More sharing options...
cramaboule Posted July 28, 2007 Share Posted July 28, 2007 (edited) Hi all,In the same idea I created a small program to See strait away which server, AP , printer,.. is not "pinging" showing red or green the Ip and "his name".I am running a linux server, and I take the hosts file from there and Ping my list.feel free to use it to modify it !Cramaboule.PS the grip.dll contain only icons related to this post and this one that I put a while ago ! (basically a green and red icon - sorry i don't know how to upload a zip file.... )expandcollapse popup[/b]#comments-start History: Ping Test 1.3 Rewrite from scratch (almost !) Add refresh button ! Ping Test 1.2 Add tray icons (from grip.dll) Ping Test 1.1 Add switch for file for batch file: Pingtest1.1.exe [file] Open witout prompting Ping Test 1.0 First realese Made By Marc Arm 2006-2007 #comments-end #include <Constants.au3> #include <GuiConstants.au3> #include <iNet.au3> #NoTrayIcon Opt("TrayMenuMode", 1) ; Default tray menu items (Script Paused/Exit) will not be shown. Global $Nb_of_machines = 1, $button_hide = 1, $button_show = 1, $ShowAllPing = 1, $Nb_of_ping = 0, $f = 0 Global $machine[60][5], $machine_not_good[60][5], $Input[60][5], $seq[100], $Winposping[4] Global $noping, $head, $file, $exititem, $showframe, $showgooditem, $gui, $winstate Global $pPing, $Ttimer, $Tflag, $Tdiff, $RedoGui, $NewMachine, $OldMachine, $msg, $oldnoping, $messtray Global $trayrefresh, $showframe, $winstatetray Global Const $TWait = 30000 ; head-------------------------------------------------- $head = "Ping Test 1.3" If @Compiled <> 0 Then ;Install (copy) the program in $path = @ProgramFilesDir & "\Ping Test\"; ..\program files\Ping Test\ $pathstart = @ProgramsCommonDir & "\Ping Test\"; ..\All Users\start menu\program\Ping Test\ FileCopy(@ScriptFullPath, $path & $head & ".exe", 9) FileCreateShortcut($path & $head & ".exe", $path & $head, $path, "\\linux\linux\etc\hosts") DirCreate($pathstart) FileCreateShortcut($path & $head & ".exe", $pathstart & $head) FileCopy(@ScriptDir & "\grip.dll", @SystemDir & "\grip.dll", 9) FileCopy(@ScriptDir & "\readme.txt", $path & "readme.txt", 9) EndIf $trayrefresh = TrayCreateItem("Refresh") $showgooditem = TrayCreateItem("Show/Hide Good Pings") $showframe = TrayCreateItem("Show/Hide " & $head) $exititem = TrayCreateItem("Exit") TraySetIcon("grip.DLL", 0) TraySetState() If $CmdLine[0] And $CmdLine[1] <> "" Then $file = $CmdLine[1] Else $file = FileOpenDialog($head, "::{20D04FE0-3AEA-1069-A2D8-08002B30309D}", "All (*.*)", 1, "hosts") If $file = "" Then Exit EndIf Call("getmachine") $gui = GUICreate($head, 300, (17* ($Nb_of_machines - 1)) + 20, 700, -1) $Winposping = WinGetPos($head) $button_hide = GUICtrlCreateButton("<< Hide", 180, 17* ($Nb_of_machines - 1), 100, 20) $button_refresh = GUICtrlCreateButton("Refresh", 20, 17* ($Nb_of_machines - 1), 100, 20) For $i = 1 To $Nb_of_machines - 1 $Input[$i][1] = GUICtrlCreateInput($machine[$i][1], 10, 17* ($i - 1), 90, 17, $ES_READONLY) $Input[$i][2] = GUICtrlCreateInput($machine[$i][2], 100, 17* ($i - 1), 190, 17, $ES_READONLY) GUICtrlSetBkColor($Input[$i][1], 0xffff00) ; yellow GUICtrlSetBkColor($Input[$i][2], 0xffff00) ; yellow Next GUISetState(@SW_SHOWNORMAL, $gui) $winstatetray = 1 $RedoGui = 0 Call("fPing"); for the first one While 1 $msg = GUIGetMsg() Select Case $msg = $GUI_EVENT_CLOSE Exit Case $msg = $button_refresh $RedoGui = 1 Case $msg = $button_show Or $msg = $button_hide $RedoGui = 1 $ShowAllPing = Not ($ShowAllPing) Case $msg = $GUI_EVENT_MINIMIZE $winstatetray = 0 GUISetState(@SW_HIDE, $gui) EndSelect $traymsg = TrayGetMsg() Select Case $traymsg = $exititem Exit Case $traymsg = $showframe If $winstatetray = 1 Then GUISetState(@SW_HIDE, $gui) $winstatetray = Not ($winstatetray) Else GUISetState(@SW_SHOWNORMAL, $gui) $winstatetray = Not ($winstatetray) EndIf Case $traymsg = $showgooditem $RedoGui = 1 $ShowAllPing = Not ($ShowAllPing) Case $traymsg = $trayrefresh $RedoGui = 1 EndSelect ; If $pPing >= 1 Then If $ShowAllPing Then GUICtrlSetBkColor($Input[$Nb_of_ping][1], 0x00ff00) ; green GUICtrlSetBkColor($Input[$Nb_of_ping][2], 0x00ff00) ; green EndIf Else If $f = 0 Then $noping += 1 TraySetIcon("grip.DLL", 1) $f = 1 $machine_not_good[$noping][1] = $machine[$Nb_of_ping][1] $machine_not_good[$noping][2] = $machine[$Nb_of_ping][2] If $ShowAllPing Then GUICtrlSetBkColor($Input[$Nb_of_ping][1], 0xff0000) ; red GUICtrlSetBkColor($Input[$Nb_of_ping][2], 0xff0000) ; red Else GUICtrlSetBkColor($Input[$noping][1], 0xff0000) ; red GUICtrlSetBkColor($Input[$noping][2], 0xff0000) ; red EndIf EndIf If $noping > 1 Then $messtray &= @CRLF & $machine_not_good[$noping][1] & " " & $machine_not_good[$noping][2] Else $messtray &= $machine_not_good[$noping][1] & " " & $machine_not_good[$noping][2] EndIf EndIf $Tdiff = TimerDiff($Ttimer) If $RedoGui = 1 Then Call("CreateGui") If $Tdiff >= $TWait Or $RedoGui = 1 Or $Nb_of_ping > 0 Then Call("fPing") EndIf WEnd Func getmachine() $NewMachine = "" $Nb_of_machines = 1 $hosts = FileOpen($file, 0) If $hosts = -1 Then MsgBox(48, "Error:", "cannot open " & $file & " make sure the path is correct !") Exit EndIf While 1 $hline = FileReadLine($hosts) $line = "" If @error = -1 Then FileClose($hosts) ExitLoop Else If StringInStr($hline, Chr(9)) >= 1 Then $hline = StringReplace($hline, Chr(9), " ", 0) EndIf $seq = StringSplit($hline, " ") $j = 0 For $i = 1 To $seq[0] ; Get ride of the 'SPACE' and 'CPU' and '#' and 'dialin' If StringLeft($seq[$i], 1) = "#" Or StringLeft($seq[$i], 3) = "CPU" Or StringLeft($seq[$i], 6) = "dialin" Then ExitLoop If $seq[$i] <> "" Then $j += 1 $machine[$Nb_of_machines][$j] = $seq[$i] If $j = 2 Then $NewMachine &= $machine[$Nb_of_machines][1] & " " & $machine[$Nb_of_machines][2] & " " $Nb_of_machines += 1 ExitLoop EndIf EndIf Next EndIf WEnd If $NewMachine <> $OldMachine Then $RedoGui = 1 $OldMachine = $NewMachine EndFunc ;==>getmachine Func fPing() $Nb_of_ping += 1 ; If $Nb_of_ping = 1 Then Call("getmachine") If (Not ($ShowAllPing) And $noping <> $oldnoping) Or $RedoGui = 1 Then $oldnoping = $noping Call("CreateGui") EndIf $noping = 0 $messtray = "" EndIf ; $TOut = 5000 ; THIS LINE BELOW NEED TO BE ADJUSTED TO YOUR NETWORK----- If StringLeft($machine[$Nb_of_ping][1], 6) = "10.1." Then $TOut = 200 ; ------------------------------------------------------------- If $ShowAllPing Then GUICtrlSetBkColor($Input[$Nb_of_ping][1], 0xffff00) ; yellow GUICtrlSetBkColor($Input[$Nb_of_ping][2], 0xffff00) ; yellow Else GUICtrlSetBkColor($Input[$noping][1] + 2, 0xffff00) ; yellow GUICtrlSetBkColor($Input[$noping][2] + 2, 0xffff00) ; yellow EndIf ; $pPing = Ping($machine[$Nb_of_ping][1], $TOut) ; If $Nb_of_ping >= $Nb_of_machines Then If $noping = 0 Then TraySetIcon("grip.dll", 0) $messtray = $head $f = 1 Else $f = 1 EndIf ; TraySetToolTip($messtray) $Nb_of_ping = 0 $Ttimer = TimerInit() Return EndIf $f = 0 EndFunc ;==>fPing Func CreateGui() $state = WinGetState($head, "") If Not BitAND($state, 2) Then ; 2 = visible $winstate = 0 ElseIf Not BitAND($state, 8) Then ; 8 = active $winstate = 1 Else $winstate = 2 EndIf $Winposping = WinGetPos($head) GUIDelete($gui) ; If $Nb_of_ping > 1 Then $Nb_of_ping = 0 $Tdiff = $TWait ; If $ShowAllPing Then $gui = GUICreate($head, 300, (17* ($Nb_of_machines - 1)) + 20, $Winposping[0], $Winposping[1]) $button_hide = GUICtrlCreateButton("<< Hide", 180, 17* ($Nb_of_machines - 1), 100, 20) $button_refresh = GUICtrlCreateButton("Refresh", 20, 17* ($Nb_of_machines - 1), 100, 20) For $i = 1 To $Nb_of_machines - 1 $Input[$i][1] = GUICtrlCreateInput($machine[$i][1], 10, 17* ($i - 1), 90, 17, $ES_READONLY) $Input[$i][2] = GUICtrlCreateInput($machine[$i][2], 100, 17* ($i - 1), 190, 17, $ES_READONLY) GUICtrlSetBkColor($Input[$i][1], 0xffff00) ; yellow GUICtrlSetBkColor($Input[$i][2], 0xffff00) ; yellow Next Else $oldnoping = $noping $gui = GUICreate($head, 300, (17 * $noping) + 20, $Winposping[0], $Winposping[1]) $button_show = GUICtrlCreateButton("Show >>", 180, 17 * $noping, 100, 20) $button_refresh = GUICtrlCreateButton("Refresh", 20, 17* ($noping), 100, 20) For $i = 1 To $noping $Input[$i][1] = GUICtrlCreateInput($machine_not_good[$i][1], 10, 17* ($i - 1), 90, 17, $ES_READONLY) $Input[$i][2] = GUICtrlCreateInput($machine_not_good[$i][2], 100, 17* ($i - 1), 190, 17, $ES_READONLY) GUICtrlSetBkColor($Input[$i][1], 0xffff00) ; yellow GUICtrlSetBkColor($Input[$i][2], 0xffff00) ; yellow Next EndIf ; Select Case $winstate = 2 ; 2 -> active GUISetState(@SW_SHOWNORMAL, $gui) Case $winstate = 1 ; 1 -> not active GUISetState(@SW_SHOWNOACTIVATE, $gui) Case $winstate = 0 ; 0 -> on the tray GUISetState(@SW_HIDE, $gui) EndSelect $RedoGui = 0 EndFunc ;==>CreateGui [b]EDIT: added other post Edited August 19, 2007 by cramaboule My Autoit programs: MAC Address - - Delete Temp Files - - Ping Test - - Play Video with VLC full screen dual monitors - - Set IP - - Pics Converter - - AutoUpdater - - CPU Usage - - Ending Script Nicely - - GDI+ GUI crossfades (slide transitions) - - Beamer - - Search and Search in Files - - Silent Ninite Others: Export Icons into Dll - - My website Link to comment Share on other sites More sharing options...
KegRaider Posted August 7, 2007 Share Posted August 7, 2007 Hi all, This is my first Script/Program. I made for my work, as an IT i need so constantly have some info/status/whatever from servers so, this mass ping program its usefull.. The exportation file is comma delimited for an easier usage in excel! And now im happy to share with you all. Cheers. Any problem, ideas please let me know! Thanks November! This is EXACTLY what i was looking to do myself today, with one addition.... To show the free space on C: so we can find how many users have filled the HDD's with MP3's etc. Shouldn't be hard to implement an autoit equivalent to the DOS batch i wrote a while back.. net use y: \\PCNAME\C$ echo Asset# PCNAME >> c:\freelog.txt dir y: | grep -i "bytes free" >> C:\freelog.txt c: cd \ net use y: /delete Shall post here when i get a minute or 10 Link to comment Share on other sites More sharing options...
November Posted August 7, 2007 Author Share Posted August 7, 2007 Thanks November! This is EXACTLY what i was looking to do myself today, with one addition.... To show the free space on C: so we can find how many users have filled the HDD's with MP3's etc. Shouldn't be hard to implement an autoit equivalent to the DOS batch i wrote a while back.. net use y: \\PCNAME\C$ echo Asset# PCNAME >> c:\freelog.txt dir y: | grep -i "bytes free" >> C:\freelog.txt c: cd \ net use y: /delete Shall post here when i get a minute or 10 Hi there m8, But inside the visual ping program? cheers Old Scriptology Visual Ping 1.8 - Mass Ping Program with export to txt delimited. Desktop 2 RGB and YMCK - Pick a color in the desktop and get the RGB and YMCK code. Desktop 2 RGB - Pick a color in the desktop and get the RGB code. ShootIT 1.0 - Screen Capture full and partial screen [font="'Arial Black';"]Remember Remember The Fifth of November.[/font] Link to comment Share on other sites More sharing options...
RelaxXx Posted August 19, 2007 Share Posted August 19, 2007 Hey guys, I'm only a beginner in programming with AutoIt so I want to ask if someone of you can do it for me and the community It concerns that the exported textfile always includes all Proxys. I think it would be an advantage if only the working Proxys are exported. Sry for my bad english. Hope you can understand me So long Link to comment Share on other sites More sharing options...
November Posted August 20, 2007 Author Share Posted August 20, 2007 Hey guys,I'm only a beginner in programming with AutoIt so I want to ask if someone of you can do it for me and the community It concerns that the exported textfile always includes all Proxys. I think it would be an advantage if only the working Proxys are exported.Sry for my bad english. Hope you can understand me So longHi m8, welcome aboard I'm sorry but i didnt quite understand what you are saying!Do you want to check in a group of proxy servers, witch of them are giving proxy server?Regards, Old Scriptology Visual Ping 1.8 - Mass Ping Program with export to txt delimited. Desktop 2 RGB and YMCK - Pick a color in the desktop and get the RGB and YMCK code. Desktop 2 RGB - Pick a color in the desktop and get the RGB code. ShootIT 1.0 - Screen Capture full and partial screen [font="'Arial Black';"]Remember Remember The Fifth of November.[/font] Link to comment Share on other sites More sharing options...
November Posted September 17, 2009 Author Share Posted September 17, 2009 New version uploaded. Vista and Win7 compatible! P.S. - Mike Thanks for the new ideas Cheers all! Old Scriptology Visual Ping 1.8 - Mass Ping Program with export to txt delimited. Desktop 2 RGB and YMCK - Pick a color in the desktop and get the RGB and YMCK code. Desktop 2 RGB - Pick a color in the desktop and get the RGB code. ShootIT 1.0 - Screen Capture full and partial screen [font="'Arial Black';"]Remember Remember The Fifth of November.[/font] 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