$IPAddress = "255.255.255.255"; This is the broadcast address !
$MACAddress = "E43A6E0775B8"
UDPStartUp()
$connexion = UDPOpen($IPAddress, 5888,1)
$res = UDPSend($connexion, GenerateMagicPacket($MACAddress))
MsgBox(0, "", $res)
UDPCloseSocket($connexion)
UDPShutdown()
; ===================================================================
; Functions
; ===================================================================
; This function convert a MAC Address Byte (e.g. "1f") to a char
Func HexToChar($strHex)
Return Chr(Dec($strHex))
EndFunc
; This function generate the "Magic Packet"
Func GenerateMagicPacket($strMACAddress)
$MagicPacket = ""
$MACData = ""
For $p = 1 To 11 Step 2
$MACData = $MACData & HexToChar(StringMid($strMACAddress, $p, 2))
Next
For $p = 1 To 6
$MagicPacket = HexToChar("ff") & $MagicPacket
Next
For $p = 1 To 16
$MagicPacket = $MagicPacket & $MACData
Next
Return $MagicPacket
EndFunc
网络唤醒Autoit代码
最新推荐文章于 2024-04-29 16:23:08 发布