realkiller Posted April 18, 2008 Share Posted April 18, 2008 (edited) iam trying to look for every hostname on my b address but it dont seem to look further then 1, it must count from172.29.1.1 till 172.29.254.254 expandcollapse popup#include <GUIConstants.au3> #include <inet.au3> Dim $f,$i,$sIp GUICreate("My GUI list"); will create a dialog box that when displayed is centered $add=GUICtrlCreateButton ("Add", 64,32,75,25) $clear=GUICtrlCreateButton ("Clear", 64,72,75,25) $mylist=GUICtrlCreateList ("", 176,32,121,97) GUICtrlSetLimit(-1,200); to limit horizontal scrolling $close=GUICtrlCreateButton ("my closing button", 64,160,175,25) GUISetState () $msg = 0 While $msg <> $GUI_EVENT_CLOSE $msg = GUIGetMsg() Select case $msg = $add TCPStartup() do For $i = 1 to 254 Step +1 $f = Number(1) $sIp= "172.29."&$f&"."&$i GUICtrlSetData($mylist,$sIp) if $i = "254"Then $bla = Number($f +1) $ssIp= "172.29."&$bla&"."&$i GUICtrlSetData($mylist,$ssIp) EndIf ;~ $result =_TCPIpToName ($sIp) Next Until $f = 254 case $msg = $clear GUICtrlSetData($mylist,"") Case $msg = $close MsgBox(0,"", "the closing button has been clicked",2) Exit EndSelect Wend Edited April 18, 2008 by realkiller Remote 3.1 BetaRemote Media Player ControlUSB Security 1.2 Link to comment Share on other sites More sharing options...
cramaboule Posted April 18, 2008 Share Posted April 18, 2008 iam trying to look for every hostname on my b address but it dont seem to look further then 1, it must count from172.29.1.1 till 172.29.254.254 For $i = 1 to 254 For $j = 1 to 254 [...] Next Next try something like this !!! 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...
realkiller Posted April 18, 2008 Author Share Posted April 18, 2008 For $i = 1 to 254 For $j = 1 to 254 [...] Next Next try something like this !!! Cramaboule !that won't work Remote 3.1 BetaRemote Media Player ControlUSB Security 1.2 Link to comment Share on other sites More sharing options...
realkiller Posted April 18, 2008 Author Share Posted April 18, 2008 that won't work fount it myself but now is the question how can sort the numbers? expandcollapse popup#include <GUIConstants.au3> #include <inet.au3> Dim $f,$i,$sIp GUICreate("My GUI list",800,600); will create a dialog box that when displayed is centered $add=GUICtrlCreateButton ("Add", 64,32,75,25) $clear=GUICtrlCreateButton ("Clear", 64,72,75,25) $mylist=GUICtrlCreateList ("", 176,32,150,400) GUICtrlSetLimit(-1,-1); to limit horizontal scrolling GUISetState () $msg = 0 While $msg <> $GUI_EVENT_CLOSE $msg = GUIGetMsg() Select case $msg = $add TCPStartup() $f = Number(1) do For $i = 1 to 254 Step +1 if $i = "254"Then $f = Number($f +1) EndIf $sIp= "172.29."&$f&"."&$i GUICtrlSetData($mylist,$sIp) ;~ $result =_TCPIpToName ($sIp) Next Until $f = 254 case $msg = $clear GUICtrlSetData($mylist,"") EndSelect Wend Remote 3.1 BetaRemote Media Player ControlUSB Security 1.2 Link to comment Share on other sites More sharing options...
ProgAndy Posted April 18, 2008 Share Posted April 18, 2008 (edited) IPs can be converted from Numeric to String and the way round, too. So you can use this Code For $i = 2887581953 To 2887646974 ConsoleWrite(IpConvert($i) & @LF) Next Func IpConvert($asNewIP) Local $x,$Num,$return If IsNumber($asNewIP) Then For $x = 1 To 4 $Num = Int($asNewIP / 256 ^ (4 - $x)) $asNewIP -= ($Num * 256 ^ (4 - $x)) If $Num > 255 Then Return "0.0.0.0" EndIf If $x = 1 Then $return = $Num Else $return &= "." & $Num EndIf Next Return $return Else Local $lnResults, $lnIndex, $lnIpAry $lnIpAry = StringSplit($asNewIP, ".") If $lnIndex[0] <> 4 THen Return -1 For $lnIndex = 1 To 4 If Not ($lnIndex = 4) Then $lnIpAry[$lnIndex] *= (256 ^ (4 - $lnIndex)) EndIf $lnResults += $lnIpAry[$lnIndex] Next Return $lnResults EndIf Return(-1) EndFunc //Edit: the List sorts them automatically in alphabeltical order. To avoid that, use $mylist=GUICtrlCreateList ("", 176,32,121,97,$WS_BORDER+ $WS_VSCROLL) The ListView mustn't sort the IPs because they are created in the right order Edited April 18, 2008 by ProgAndy *GERMAN* [note: you are not allowed to remove author / modified info from my UDFs]My UDFs:[_SetImageBinaryToCtrl] [_TaskDialog] [AutoItObject] [Animated GIF (GDI+)] [ClipPut for Image] [FreeImage] [GDI32 UDFs] [GDIPlus Progressbar] [Hotkey-Selector] [Multiline Inputbox] [MySQL without ODBC] [RichEdit UDFs] [SpeechAPI Example] [WinHTTP]UDFs included in AutoIt: FTP_Ex (as FTPEx), _WinAPI_SetLayeredWindowAttributes 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