#NOTRAYICON
$g_szVersion = "My Script 1.1"
If WinExists($g_szVersion) Then Exit
AutoItWinSetTitle($g_szVersion)
#include <GUIConstants.au3>
GUICreate("群PING工具", 198, 76)
GUICtrlCreateGroup("", 12, 0, 129, 69)
$Button1 = GUICtrlCreateButton("开始", 152, 8, 37, 21)
$Button2 = GUICtrlCreateButton("退出", 152, 44, 37, 21)
GUICtrlCreateLabel("IP前缀", 16, 16, 38, 17)
$Input1 = GUICtrlCreateInput("192.168.0", 60, 12, 73, 17)
GUICtrlSetLimit(-1,15)
GUICtrlCreateLabel("从", 20, 44, 16, 17)
GUICtrlCreateLabel("到", 80, 44, 16, 17)
$Input2 = GUICtrlCreateInput("1", 40, 44, 29, 17, $ES_NUMBER)
GUICtrlSetLimit(-1,3)
$Input3 = GUICtrlCreateInput("255", 104, 44, 29, 17, $ES_NUMBER)
GUICtrlSetLimit(-1,3)
GUICtrlCreateGroup("", -99, -99, 1, 1)
GUISetState(@SW_SHOW)
While 1
$msg = GuiGetMsg()
Select
Case $msg = $GUI_EVENT_CLOSE or $msg = $button2
Exit
Case $msg = $Button1
start()
EndSelect
WEnd
Exit
func start()
$IPPREFIX = GUICTRLREAD($INPUT1)
$startIP = GUICTRLREAD($INPUT2)
$endIP = GUICTRLREAD($INPUT3)
IF $startIP < 1 or $startIP > 255 THEN
msgbox(0,"警告","起始IP范围只能为1-255!")
RETURN
ENDIF
IF $endIP < 1 or $endIP > 255 THEN
msgbox(0,"警告","终止IP范围只能为1-255!")
RETURN
ENDIF
IF Number($ENDip) < Number($startIP) THEN
$temp = $startIP
$startIP = $endiP
$endiP = $temp
ENDIF
$IPPREFIX = StringStripWS($IPPREFIX,8)
$IPPREFIX1 = stringsplit($IPPREFIX,".")
if $IPPREFIX1[0] <> 3 then
msgbox(0,"警告","你输入的IP前缀有误!")
RETURN
ENDIF
if $IPPREFIX1[1] = "" or $IPPREFIX1[1] < 1 or $IPPREFIX1[1] > 255 then
msgbox(0,"警告","你输入的IP前缀有误!")
RETURN
ENDIF
for $x = 2 to $IPPREFIX1[0]
if $IPPREFIX1[$x] = "" or $IPPREFIX1[$x] < 0 or $IPPREFIX1[$x] > 255 then
msgbox(0,"警告","你输入的IP前缀有误!")
RETURN
ENDIF
next
$filename = @scriptdir & "\" & @MON & "月" & @MDAY & "日" & @HOUR & "-" & @MIN & "-" & @SEC & ".log"
tooltip ("探测中,请稍候...",200,0)
FILEWRITELINE($filename,"在线主机列表:")
for $x = $startIP to $endip
$msg = GuiGetMsg()
IF $msg = $GUI_EVENT_CLOSE or $msg = $button2 THEN EXIT
$TEMP = $IPPREFIX & "." & $x
$online = ping($TEMP,100)
IF $ONLINE THEN FILEWRITELINE($filename,$TEMP)
NEXT
tooltip ("")
$viewlog = msgbox (68,"恭喜","探测完成,结果保存在 "& $FILENAME &" 中,是否查看?")
if $viewlog = 6 then run(@SystemDir &"\notepad.exe " & $FILENAME)
endfunc
posted on 2007-11-01 13:49
疾风随影 阅读(1204)
评论(0) 编辑 收藏 引用 所属分类:
Script & Batch column