Custom PlugIn for WakeOnLan

Just wrote a Custom PlugIn for WakeOnLan, tested worked fine. Make sure your PC allows WOL in Bios.

Use it with send "PlugIn Message" and use MAC-Adress without colons as message.

function WakeOnLan_Initialize(msgPort as Object, userVariables as Object, o as Object)

    WakeOnLanBuilder = newWakeOnLanBuilder(msgPort, userVariables, o)

    return WakeOnLanBuilder
end function
function newWakeOnLanBuilder(msgPort as Object, userVariables as Object, obj as Object)

    WakeOnLanBuilder                = { }
    WakeOnLanBuilder.msgPort        = msgPort
    WakeOnLanBuilder.bsp            = obj
    WakeOnLanBuilder.userVariables    = userVariables
    WakeOnLanBuilder.objectName     = "WakeOnLan_object"
    WakeOnLanBuilder.ProcessEvent     = WakeOnLan_ProcessEvent
    WakeOnLanBuilder.WoLsender         = createobject("roDatagramSender")
    WakeOnLanBuilder.WoLsender.SetDestination("", 7)
    return WakeOnLanBuilder
end function
function WakeOnLan_ProcessEvent(event as Object)
    'handle Message and send WakeOnLan Command
    print event
    if type(event) = "roAssociativeArray" then
        if type(event["EventType"]) = "roString"
            if event["EventType"] = "SEND_PLUGIN_MESSAGE" then
                if event["PluginName"] = "WakeOnLan" then
                    mac_adress$ = event["PluginMessage"]
                    sendString$    = "FFFFFFFFFFFF"
                    for i=1 to 16 step 1
                        sendString$ = sendString$ + mac_adress$
                    end for
                    print "*************************************************"
                    print "MacAdress:";mac_adress$
                    print "sendString:";sendString$
                    print "*************************************************"
                    wolBytes = CreateObject("roByteArray")
    return false
end function


1 comment

  • 0
    Joseph Marchesseau

    Thanks, it works well !

Please sign in to leave a comment.