Dim $ip, $oldip, $newip
Global $oMyRet[2]
Global $oMyError = ObjEvent("AutoIt.Error", "MyErrFunc")
Global $Paused
HotKeySet("{PAUSE}", "_Exit")
$oldip = _GetIP()
$Form1 = GUICreate("Joanna Lee", 183, 86, 370, 198)
$Checkbox = GUICtrlCreateCheckbox("自动发送 IP 到Email", 5, 35, 153, 25)
GUICtrlSetFont(-1, 12, 400, 0, "微软雅黑")
$setip = GUICtrlCreateLabel($oldip, 5, 8, 172, 20)
GUICtrlSetFont(-1, 17, 800, 0, "微软雅黑")
GUICtrlSetColor(-1, 0x00FF00)
$time = GUICtrlCreateLabel("", 5, 70, 172, 20)
GUICtrlSetFont(-1, 10, 800, 0, "微软雅黑")
GUICtrlSetColor(-1, 0x456FFF)
GUISetState(@SW_SHOW)
Global $Itime = 10
AdlibRegister('__Timer', 1000)
While 1
$nMsg = GUIGetMsg()
Switch $nMsg
Case -3
_Exit()
Case $setip
MsgBox(0, "", GUICtrlRead($setip))
EndSwitch
WEnd
Func __Timer()
GUICtrlSetData($time, "距离下次刷新时间还有" & $Itime & "秒")
$Itime -= 1
If $Itime >= 0 Then Return
$Itime = 10
$newip = _GetIP()
GUICtrlSetData($setip, $newip)
If GUICtrlRead($Checkbox) = 1 Then
If $oldip <> $newip And $oldip <> "0.0.0.0" Then MsgBox(64, 'ok', '进入发送Email函数')
Else
If $oldip <> $newip And $oldip <> "0.0.0.0" Then
$selec = MsgBox(65, "温馨提醒", "当前IP已变更,是否发送Email", 3)
If $selec = 1 Then MsgBox(64, 'ok', '进入发送Email函数')
EndIf
EndIf
EndFunc ;==>__Timer
Func _GetIP()
$ip = InetRead("http://iframe.ip138.com/ic.asp", 1)
$ip = BinaryToString($ip, 8)
$ip = StringStripCR($ip)
$ip = StringSplit($ip, "[")
$ip = StringSplit($ip[$ip[0]], "]")
If $ip[1] <> "" Then Return $ip[1]
Return "0.0.0.0"
EndFunc ;==>_GetIP
Func MyErrFunc()
$HexNumber = Hex($oMyError.number, 8)
$oMyRet[0] = $HexNumber
$oMyRet[1] = StringStripWS($oMyError.description, 3)
ConsoleWrite("### COM Error ! Number: " & $HexNumber & " ScriptLine: " & $oMyError.scriptline & " Description:" & $oMyRet[1] & @LF)
Return SetError(1); something to check for when this function returns
EndFunc ;==>MyErrFunc
Func _Exit()
Exit
EndFunc ;==>_Exit