Getting results from an embedded HTML button

This forum is for questions / discussions regarding development of addons / tweaks for MediaMonkey.

Moderator: Gurus

Just Guessing
Posts: 64
Joined: Mon Sep 03, 2012 12:06 pm

Getting results from an embedded HTML button

Post by Just Guessing » Thu Nov 06, 2014 11:58 am

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

trixmoto
Posts: 10024
Joined: Fri Aug 26, 2005 3:28 am
Location: Barton, UK
Contact:

Re: Getting results from an embedded HTML button

Post by trixmoto » Fri Nov 07, 2014 8:05 am

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.
Download my scripts at my own MediaMonkey fansite.
All the code for my website and scripts is safely backed up immediately and for free using Dropbox.
Send me BTC: 34VQPVsf9mCeR4nfhFvvBYZqQ7LkqNZ8Mn
Send me LTC: 3P1mzrfbyscdhbxRpXLgKz7tufGAU3SrEG
Send me DOGE: 9xPpYSqgF7P5yQiqvE1VqWb4UjxVCCLFJ6
Check out these great cryptocurrency faucets... BTC / LTC / DOGE

Just Guessing
Posts: 64
Joined: Mon Sep 03, 2012 12:06 pm

Re: Getting results from an embedded HTML button

Post by Just Guessing » Fri Nov 07, 2014 12:28 pm

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'™®

Post Reply