Page 1 of 1

Getting results from an embedded HTML button

Posted: Thu Nov 06, 2014 11:58 am
by Just Guessing
Hi.
Why doesn't this work? (html in MM dockable panel)

Code: Select all

Doc.Write "<HTML><HEAD>"
Doc.Write "<SCRIPT type=""text/vbscript"">"
	
Doc.Write "Sub ClearNP()"
      Doc.Write "Dim SDB : Set SDB = CreateObject(""SongsDB.SDBApplication"")"	
      Doc.Write "SDB.ShutdownAfterDisconnect = False"
      Doc.Write "SDB.PLAYER.PlayListClear "
    ' Doc.Write "MsgBox ""this works"" "
Doc.Write "End Sub"
	
Doc.Write "</SCRIPT>"
Doc.Write "</HEAD><BODY><div >"

Doc.Write "<input type=""button"" name=""button"" value=""buttonvalue""  onclick=""ClearNP()""/>"

Doc.Write "</div></BODY></HTML>"
	


If I test with the msg box uncommented and SDB stuff commented, it all works as expected;
but I can't get an HTML button to control any SongsDB/MM functionality no matter what direction I've tried. What am I missing??
Thanks

Re: Getting results from an embedded HTML button

Posted: Fri Nov 07, 2014 8:05 am
by trixmoto
I have found security issues trying to write directly to the HTML source like this. All my scripts create a temporary .htm file and then navigate to it, so at least it's in the My Computer zone which can then be given access. I also use Functions, not Subs, but I don't know if there's a reason for that or not, it's a long time since I've done this.

For an example, you could check out my "Cue Reader" script, amongst others.

Re: Getting results from an embedded HTML button

Posted: Fri Nov 07, 2014 12:28 pm
by Just Guessing
Well its good to learn of security vulnerability. I will look at 'Cue Reader' - though many of your scripts are so sophisticated and large in scope that I often am not sure I understand what's going on in them. I definitely have learned SO MUCH from your contributions!!!

But whats not working here, specificly, is that an HTML button, in a MMonkey panel, cant seem to fire any MMonkey actions ( what I'm after is to add a song to NP). It can fire a WINDOWS action like a message box without issue.

EDIT: Following the page creation structure used in Cue Reader, an HTML button now works as expected. I'm not sure why the other methods I've tried for creating html pages fail in this regard, but who cares! From here on I write embedded HTML 'Trixmoto Style'™®