望各位大侠帮忙改下。。。小弟不尽感激,谢谢,拜托各位拉。。。
后面那段为什么不可以用呢?
#include <ButtonConstants.au3>
#include <EditConstants.au3>
#include <GUIConstantsEx.au3>
#include <StaticConstants.au3>
#include <WindowsConstants.au3>
#include <Constants.au3>
Opt('GUIOnEventMode', 1)
#Region ### START Koda GUI section ### Form=\\192.168.1.250\上传\0.编辑文件备份\_AU3\1.判断\PING\ping.kxf
$Form1 = GUICreate("服务器启动", 299, 251, 313, 311)
$Group1 = GUICtrlCreateGroup("网络状态监控", 16, 8, 265, 209)
$Name1 = GUICtrlCreateLabel("XXX服务器", 41, 32, 61, 17)
$Name2 = GUICtrlCreateLabel("XXX服务器", 41, 51, 61, 17)
$Name3 = GUICtrlCreateLabel("XXX服务器", 41, 72, 61, 17)
$Name4 = GUICtrlCreateLabel("XXX服务器", 41, 92, 61, 17)
$Name5 = GUICtrlCreateLabel("XXX服务器", 40, 110, 61, 17)
$Name6 = GUICtrlCreateLabel("XXX服务器", 40, 130, 61, 17)
$Name7 = GUICtrlCreateLabel("XXX服务器", 40, 150, 61, 17)
$Name8 = GUICtrlCreateLabel("XXX服务器", 40, 170, 61, 17)
$Name9 = GUICtrlCreateLabel("XXX服务器", 40, 187, 61, 17)
$PING9 = GUICtrlCreateLabel("***", 154, 187, 16, 17)
$PING8 = GUICtrlCreateLabel("***", 154, 170, 16, 17)
$PING7 = GUICtrlCreateLabel("***", 154, 150, 16, 17)
$PING6 = GUICtrlCreateLabel("***", 154, 130, 16, 17)
$PING5 = GUICtrlCreateLabel("***", 154, 110, 16, 17)
$PING4 = GUICtrlCreateLabel("***", 155, 92, 16, 17)
$PING3 = GUICtrlCreateLabel("***", 155, 72, 16, 17)
$PING2 = GUICtrlCreateLabel("***", 155, 51, 16, 17)
$PING1 = GUICtrlCreateLabel("***", 155, 32, 16, 17)
$Label1 = GUICtrlCreateLabel("已关闭", 114, 31, 40, 17)
$Label2 = GUICtrlCreateLabel("已关闭", 114, 50, 40, 17)
$Label3 = GUICtrlCreateLabel("已关闭", 114, 71, 40, 17)
$Label4 = GUICtrlCreateLabel("已关闭", 114, 91, 40, 17)
$Label5 = GUICtrlCreateLabel("已关闭", 113, 109, 40, 17)
$Label6 = GUICtrlCreateLabel("已关闭", 113, 129, 40, 17)
$Label7 = GUICtrlCreateLabel("已关闭", 113, 149, 40, 17)
$Label8 = GUICtrlCreateLabel("已关闭", 113, 169, 40, 17)
$Label9 = GUICtrlCreateLabel("已关闭", 113, 186, 40, 17)
$Label10 = GUICtrlCreateLabel("------------", 193, 31, 76, 17)
$Label11 = GUICtrlCreateLabel("------------", 193, 50, 76, 17)
$Label12 = GUICtrlCreateLabel("------------", 193, 71, 76, 17)
$Label13 = GUICtrlCreateLabel("------------", 193, 91, 76, 17)
$Label14 = GUICtrlCreateLabel("------------", 192, 109, 76, 17)
$Label15 = GUICtrlCreateLabel("------------", 192, 129, 76, 17)
$Label16 = GUICtrlCreateLabel("------------", 192, 149, 76, 17)
$Label17 = GUICtrlCreateLabel("------------", 192, 169, 76, 17)
$Label18 = GUICtrlCreateLabel("------------", 192, 186, 76, 17)
GUICtrlCreateGroup("", -99, -99, 1, 1)
GUISetState(@SW_SHOW)
#EndRegion ### END Koda GUI section ###
GUISetOnEvent($GUI_EVENT_CLOSE, "exit1");当一个系统按钮被点击时调用一个用户自定义函数(UDF).
While 1
fuxuankuang()
sping()
Sleep(1000) ; 超时时间1秒
WEnd
Func _ReduceMemory($i_PID = -1);内存释放函数 该函数抄自ACN论坛(http://autoitx.com)
If $i_PID <> -1 Then
Local $ai_Handle = DllCall("kernel32.dll", 'int', 'OpenProcess', 'int', 0x1f0fff, 'int', False, 'int', $i_PID)
Local $ai_Return = DllCall("psapi.dll", 'int', 'EmptyWorkingSet', 'long', $ai_Handle[0])
DllCall('kernel32.dll', 'int', 'CloseHandle', 'int', $ai_Handle[0])
Else
Local $ai_Return = DllCall("psapi.dll", 'int', 'EmptyWorkingSet', 'long', -1)
EndIf
Return $ai_Return[0]
EndFunc ;==>_ReduceMemory
Func exit1() ;退出
Exit
EndFunc ;===>exit1()
Func fuxuankuang() ;循环检测“真”
$jiankong1 = IniRead("cfg.ini", "服务器1", "监控", " ")
$jiankong2 = IniRead("cfg.ini", "服务器2", "监控", " ")
$jiankong3 = IniRead("cfg.ini", "服务器3", "监控", " ")
$jiankong4 = IniRead("cfg.ini", "服务器4", "监控", " ")
$jiankong5 = IniRead("cfg.ini", "服务器5", "监控", " ")
$jiankong6 = IniRead("cfg.ini", "服务器6", "监控", " ")
$jiankong7 = IniRead("cfg.ini", "服务器7", "监控", " ")
$jiankong8 = IniRead("cfg.ini", "服务器8", "监控", " ")
$jiankong9 = IniRead("cfg.ini", "服务器9", "监控", " ")
;====================================判断按键1
If $jiankong1 = "真" Then
;存在
GUICtrlSetData($Label10,"点击关闭监控")
Else
;不存在
GUICtrlSetData($Label10,"点击打开监控")
EndIf
;====================================判断按键1
;====================================判断按键2
If $jiankong2 = "真" Then
;存在
GUICtrlSetData($Label11,"点击关闭监控")
Else
;不存在
GUICtrlSetData($Label11,"点击打开监控")
EndIf
;====================================判断按键2
;====================================判断按键3
If $jiankong3 = "真" Then
;存在
GUICtrlSetData($Label12,"点击关闭监控")
Else
;不存在
GUICtrlSetData($Label12,"点击打开监控")
EndIf
;====================================判断按键3
;====================================判断按键4
If $jiankong4 = "真" Then
;存在
GUICtrlSetData($Label13,"点击关闭监控")
Else
;不存在
GUICtrlSetData($Label13,"点击打开监控")
EndIf
;====================================判断按键4
;====================================判断按键5
If $jiankong5 = "真" Then
;存在
GUICtrlSetData($Label14,"点击关闭监控")
Else
;不存在
GUICtrlSetData($Label14,"点击打开监控")
EndIf
;====================================判断按键5
;====================================判断按键6
If $jiankong6 = "真" Then
;存在
GUICtrlSetData($Label15,"点击关闭监控")
Else
;不存在
GUICtrlSetData($Label15,"点击打开监控")
EndIf
;====================================判断按键6
;====================================判断按键7
If $jiankong7 = "真" Then
;存在
GUICtrlSetData($Label16,"点击关闭监控")
Else
;不存在
GUICtrlSetData($Label16,"点击打开监控")
EndIf
;====================================判断按键7
;====================================判断按键8
If $jiankong8 = "真" Then
;存在
GUICtrlSetData($Label17,"点击关闭监控")
Else
;不存在
GUICtrlSetData($Label17,"点击打开监控")
EndIf
;====================================判断按键8
;====================================判断按键9
If $jiankong9 = "真" Then
;存在
GUICtrlSetData($Label18,"点击关闭监控")
Else
;不存在
GUICtrlSetData($Label18,"点击打开监控")
EndIf
;====================================判断按键9
EndFunc ;===>fuxuankuang()
Func sping() ;循环PING
For $i = 1 to 18 Step +1
Sleep(10)
$jiankong = "$jiankong"&$i
$Labe = "$Label"&$i
$ved = "服务器"&$i
$jiankong = IniRead("cfg.ini", "服务器"& $i, "监控", "假")
$name = IniRead("cfg.ini", "服务器"& $i, "服务器名", "NotFound")
$IP = IniRead("cfg.ini", "服务器"& $i, "服务器IP", "NotFound")
;##############################################################################################判断1
Sleep(10)
$socket = Ping($IP, 100) ;检测PING数
;GUICtrlSetData($ping, $socket ) ;显示PING数
GUICtrlSetData($Name, $name ) ;显示服务器名
;↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓判断=真1
If $jiankong = "真" Then ;判断有没有"真"字
;真
;↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓判断PING1
If ping($IP, 100) Then ;判断IP是否打开
GUICtrlSetData($Labe,"已开启")
Else
GUICtrlSetData($Labe,"已关闭")
EndIf
;↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑判断PING1
Else
;假
GUICtrlSetData($Labe,"未知")
EndIf
;↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑判断=真1
Next
;##############################################################################################判断1
EndFunc ;===>sping()
搞了半天,后面那段为什么不可以用呢?55555
Func sping() ;循环PING
For $i = 1 to 18 Step +1
Sleep(10)
$jiankong = "$jiankong"&$i
$Labe = "$Label"&$i
$ved = "服务器"&$i
$jiankong = IniRead("cfg.ini", "服务器"& $i, "监控", "假")
$name = IniRead("cfg.ini", "服务器"& $i, "服务器名", "NotFound")
$IP = IniRead("cfg.ini", "服务器"& $i, "服务器IP", "NotFound")
;##############################################################################################判断1
Sleep(10)
$socket = Ping($IP, 100) ;检测PING数
;GUICtrlSetData($ping, $socket ) ;显示PING数
GUICtrlSetData($Name, $name ) ;显示服务器名
;↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓判断=真1
If $jiankong = "真" Then ;判断有没有"真"字
;真
;↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓判断PING1
If ping($IP, 100) Then ;判断IP是否打开
GUICtrlSetData($Labe,"已开启")
Else
GUICtrlSetData($Labe,"已关闭")
EndIf
;↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑判断PING1
Else
;假
GUICtrlSetData($Labe,"未知")
EndIf
;↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑判断=真1
Next
;##############################################################################################判断1
EndFunc ;===>sping()
[ 本帖最后由 116154801 于 2009-3-7 05:01 编辑 ] |