借用afan的代码总算搞定了,感谢afan,论坛由你而精彩GUISetState()
UDPStartup()
$socket = UDPBind(@IPAddress1, 65532)
If @error <> 0 Then
MsgBox(0,"Error", "Server port open error")
$Server_open = 0
EndIf
While 1
;If $Server_open <> 0 Then
$data = UDPRecv($socket, 128,1)
If $data <> "" Then
$data = BinaryToString($data,4)
$Data_array = StringSplit($data,"|")
;_ArrayDisplay($Data_array)
$Number = StringRight($Data_array[1],2)
$Number = $Number - 20
GUICtrlSetData($CellID[$Number],$Data_array[2])
GUICtrlSetData($Product[$Number],$Data_array[3])
GUICtrlSetImage($pic[$Number], "C:\windows\online.jpg")
GUICtrlSetData($IP[$Number],$Data_array[4])
;GUICtrlSetColor($IP[$Number],"0x00ff00")
EndIf
;EndIf
Sleep(100)
WEnd
Func _zx()
Switch @GUI_CtrlId
Case -3
Exit
Case $Mc_ID[0] To $Mc_ID[62]
$GetIp = GUICtrlRead($IP[@GUI_CtrlId-8])
StringRegExp($GetIp,"\d{2}\.\d{2}\.\d{2,3}\.\d{2,3}", 1)
If @error <> 1 Then _RunVnc($GetIp)
EndSwitch
EndFunc ;==>_zx
;=== Run VNC and auto logon remote PC ====================================================
Func _RunVNC($iIP)
Run("C:\Program Files\RealVNC\VNC4\vncviewer.exe")
WinWait("VNC Viewer : Connection Details")
WinActivate("VNC Viewer : Connection Details")
WinWaitActive("VNC Viewer : Connection Details")
ControlSetText("VNC Viewer : Connection Details","","Edit1",$iIP)
ControlClick("VNC Viewer : Connection Details", "OK", "Button3")
WinWait("VNC Viewer : Authentication [No Encryption]")
WinActivate("VNC Viewer : Authentication [No Encryption]")
WinWaitActive("VNC Viewer : Authentication [No Encryption]")
ControlSetText("VNC Viewer : Authentication [No Encryption]","","Edit2","123")
ControlClick("VNC Viewer : Authentication [No Encryption]", "OK", "Button1")
EndFunc ;==> _RunVnc
|