ChrisL Posted September 18, 2005 Share Posted September 18, 2005 (edited) Not sure if this is going to come out written quite like what I am thinking.. What I want to do is to search for a computer (as previous thread) The computer may be of various name and workgroup, so what I am doing is finding the IP address of the machine I'm running the script from which could be 2 different ones as there are 2 network cards in the machine, so I leave the first 3 octets of the IP as is then count through 1 to 255 pinging the address for a responce, if there is a responce I then check for a file that would exist on the desired machine. Now I need to do this for each network card, so can I lob it in a function and run 2 functions simultaneously? If so how? It takes a while to run through the list of IP's so I figured I could halve the time it would be better. Any thoughts? Cheers Chris Code so far... expandcollapse popup#include <array.au3> #include <file.au3> $Computername = @computername $MyIP1 = @IPAddress1 $MyIP2 = @IPAddress2 $MyIP3 = @IPAddress3 $MyIP4 = @IPAddress4 Dim $aFrontiers = _ArrayCreate ("Frontier", "Frontier1", "EZPC00") $aOctets = StringSplit($MyIp1, ".") _FileCreate ( "Ping.txt" ) $IpCount = 0 while $IPCount < 255 $PingResult = Ping($aOctets[1] & "." & $aOctets[2] & "." & $aOctets[3] & "." & $IPCount ) $Path = $aOctets[1] & "." & $aOctets[2] & "." & $aOctets[3] & "." & $IPCount ;Check Ping for reply and see if frontier If $PingResult = 0 then;do nothing continue pinging Else;check if its a frontier $IsFrontier = FileExists ( "\\" & $Path & "\D$\Fujifilm\Frontier" ) if $IsFrontier = 0 then;if not a frontier do nothing and continue Else ;Now know its a frontier.. what to do with it now? _ArrayAdd ( $aFrontiers, $Path ) MsgBox (0,"",$IsFrontier) Endif Endif ;Logging $file = FileOpen("Ping.txt", 1) FileWriteLine ($file, $aOctets[1] & "." & $aOctets[2] & "." & $aOctets[3] & "." & $IPCount & " : " & $PingResult) $IPCount = $IPCount + 1 FileClose($file) Wend _ArrayDisplay ($aFrontiers,"") Edited September 18, 2005 by ChrisL [u]Scripts[/u]Minimize gui to systray _ Fail safe source recoveryMsgbox UDF _ _procwatch() Stop your app from being closedLicensed/Trial software system _ Buffering Hotkeys_SQL.au3 ADODB.Connection _ Search 2d Arrays_SplashTextWithGraphicOn() _ Adjust Screen GammaTransparent Controls _ Eventlogs without the crap_GuiCtrlCreateFlash() _ Simple Interscript communication[u]Websites[/u]Curious Campers VW Hightops Lambert Plant Hire Link to comment Share on other sites More sharing options...
ChrisL Posted September 18, 2005 Author Share Posted September 18, 2005 Thinking about it.. would I be quicker to just check for the file/folder rather than pinging? [u]Scripts[/u]Minimize gui to systray _ Fail safe source recoveryMsgbox UDF _ _procwatch() Stop your app from being closedLicensed/Trial software system _ Buffering Hotkeys_SQL.au3 ADODB.Connection _ Search 2d Arrays_SplashTextWithGraphicOn() _ Adjust Screen GammaTransparent Controls _ Eventlogs without the crap_GuiCtrlCreateFlash() _ Simple Interscript communication[u]Websites[/u]Curious Campers VW Hightops Lambert Plant Hire Link to comment Share on other sites More sharing options...
seandisanti Posted September 20, 2005 Share Posted September 20, 2005 Thinking about it.. would I be quicker to just check for the file/folder rather than pinging?not sure, but you can test by timing a non-responding ping and a file check, using timerinit() and timerdiff(), then compare the results. 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