I've got a client that wants to use their BrightSign XT player to display a sales dashboard. The website does require a login, which I've been able to execute through a plugin. However, I'd prefer the store the login credentials (username and password) in User Variables, so it's easier for the client to maintain them.
However, I have no idea how to do this. I've tried some different methods, but none seem to work.
Here is the content of the plugin script.
---- START PLUGIN ---
Function sendWebLogin_Initialize(msgPort As Object, userVariables As Object, bsp As Object)
sendWebLogin = newSendWebLogin(msgPort, userVariables, bsp)
return sendWebLogin
End Function
Function newSendWebLogin(msgPort As Object, userVariables As Object, bsp As Object)
'create the new object
s={}
s.objectName = "sendWebLogin_object"
s.msgPort = msgPort
s.userVariables = userVariables
s.bsp = bsp
s.htmlwidget = invalid ' We'll use the FindHTMLWidget method to set this later
s.ProcessEvent = sendWebLogin_ProcessEvent
return s
End Function
Function sendWebLogin_ProcessEvent(event As Object) as boolean
m.htmlwidget = FindHTMLWidget(m.bsp) 'find the htmlwidget in the presentation
'Receive a plugin message
if type(event) = "roHtmlWidgetEvent" then
eventData = event.getData()
if type(eventData) = "roAssociativeArray" and type(eventData.reason) = "roString" then
print "HELLOOOOOOOOO"
if eventData.reason = "load-finished" then
m.htmlwidget.InjectJavaScript("document.getElementById('username').value='my_username';document.getElementById('password').value='my_password';document.getElementById('Login').click();")
end if
end if
end if
return false
End Function
Function FindHTMLWidget(bsp)
for each baZone in bsp.sign.zonesHSM
if baZone.loadingHtmlWidget <> invalid then
return baZone.loadingHtmlWidget
end if
end for
print "Couldn't find htmlwidget"
return false
End Function
--- END PLUGIN