--[[Options --Options_Properties is a NameValueCollection of strings where you can store all your --options by name - notable methods are Get and Set --Options_ChangeHandler is the delegate you must Invoke when your options change so the --apply button can get enabled and they can get properly saved when clicked. function txtZip_TextChanged(sender, eventArgs) Options_Properties:Set("zipcode", txtZip.Text); Options_ChangeHandler:Invoke(control, EventArgs()); end; --load the assemblies luanet.load_assembly "System.Windows.Forms" luanet.load_assembly "System.Drawing" --assign the objects (#include controls can supplant this) NameValueCollection = luanet.import_type "System.Collections.Specialized.NameValueCollection" UserControl = luanet.import_type "System.Windows.Forms.UserControl" TextBox = luanet.import_type "System.Windows.Forms.TextBox" Label = luanet.import_type "System.Windows.Forms.Label" Point = luanet.import_type "System.Drawing.Point" EventArgs = luanet.import_type "System.EventArgs" --create the objects control = UserControl(); txtZip = TextBox(); lblZip = Label(); lblZip.Text = "Enter your Zipcode:"; lblZip.Location = Point(8,8); lblZip.Width = 280; s = Options_Properties:Get("zipcode"); if not s or s == "" then s = "90210" end txtZip.Text = s; txtZip.Location = Point(8,28); txtZip.Width = 280; txtZip.TextChanged:Add(txtZip_TextChanged); control.Width = 300; control.Height = 80; control.Controls:Add(txtZip); control.Controls:Add(lblZip); return control; EndOptions]]-- --scripts have the ability to display a login prompt --exactly the same way plugin's can. --username and password are passed as global variables --we can check these against our own data and return true or false --if the login passes --[[Login if username == "USERNAME" and password == "PASSWORD" then return true else return false end EndLogin]]-- --Keep in mind that all scripts are loaded into a "global" space so --if you are not careful in naming your variables and functions there --could be issues. So please name your variables very specifically --and try to keep most of your code inside of functions. --Lets create a "virtual folder". The folder will be displayed by the media player --and can be selected by the user. --This one is for Videos, and when this folder is selected the function --"testscript_Video()" will be executed. VirtualFolder("Video", "testscript_Video"); --This is our function that will be called when the user selects --the Video folder function testscript_Video() --Here we will create a "VideoResource" which is basically a --link to a Video file on the web that the media device can --recognize. VideoResource("Bugs Bunny Rabbit Rampage", "http://www.archive.org/download/004746/004746_512kb.mp4", "Bugs Bunny Rabbit Rampage Preview", "http://ia300207.us.archive.org/0/items/004746/004746.thumbs/004746_000005.jpg", 53000); --This time we'll load a video using inline code VideoResource("Bugs Bunny Rabbit Rampage (inline code)", "code:_SPECIAL_resolve_xml=ResolveXML('http://www.archive.org/download/004746/004746_512kb.mp4');", "Bugs Bunny Rabbit Rampage Preview", "http://ia300207.us.archive.org/0/items/004746/004746.thumbs/004746_000005.jpg", 53000); --We are going to create a folder with a video resource that --uses multiple video sources. VirtualFolder("Multiple Video", "testscript_MultiVideo"); end; function testscript_MultiVideo() --When displaying multiple videos you need to seperate --the video URLs with the tag. The plugin knows --that it will be multiple videos and will process it --accordingly VideoResource("Bosko Shipwrecked AND Bosko and Bruno", "http://www.archive.org/download/A_Bosko_Cartoon_Collection_1930-1932/04_Bosko_Shipwrecked_1931_512kb.mp4http://www.archive.org/download/A_Bosko_Cartoon_Collection_1930-1932/09_Bosko_and_Bruno_1932_512kb.mp4", "Bosko Shipwrecked AND Bosko and Bruno", "http://ia341041.us.archive.org/3/items/A_Bosko_Cartoon_Collection_1930-1932/A_Bosko_Cartoon_Collection_1930-1932.thumbs/01_Congo_Jazz_1930_000060.jpg", ConvertTime("10:53")); end; --we can access the options saved when our users pressed the "apply" button local zipcode = Options_Properties:Get("zipcode") if not zipcode or zipcode == "" then zipcode = "No zipcode, please set your zipcode from the Options in the Settings Manager" end VirtualFolder(zipcode, ""); --we can also tell playon to display an image --that can be used by media devices if they support them --the images are saved as a Base64 representation of the --binary data in the image. --a handy tool to convert our images into Base64 is http://www.motobit.com/util/base64-decoder-encoder.asp --[[Image /9j/4AAQSkZJRgABAQEAYABgAAD/4QCqRXhpZgAASUkqAAgAAAACADEBAgALAAAAJgAAAGmHBAABAAAAMgAAAAAAAABQaWNhc2EgMy4wAAADAACQBwAEAAAAMDIxMAWgBAABAAAAfgAAACCkAgAhAAAAXAAAAAAAAAA4MTdjOTZiNWYzYjZjMWZiNjJmYTZiM2JiMmI2ZjgzYwAAAgABAAIABQAAAJwAAAACAAcABAAAADAxMDAAAAAAICAgIAAA/+0ALFBob3Rvc2hvcCAzLjAAOEJJTQQEAAAAAAAQHAJQAAtQaWNhc2EgMy4wAP/bAEMAAgEBAQEBAgEBAQICAgICBAMCAgICBQQEAwQGBQYGBgUGBgYHCQgGBwkHBgYICwgJCgoKCgoGCAsMCwoMCQoKCv/bAEMBAgICAgICBQMDBQoHBgcKCgoKCgoKCgoKCgoKCgoKCgoKCgoKCgoKCgoKCgoKCgoKCgoKCgoKCgoKCgoKCgoKCv/AABEIAAwADAMBIgACEQEDEQH/xAAWAAEBAQAAAAAAAAAAAAAAAAAIAwT/xAAhEAABBAMBAAIDAAAAAAAAAAACAQMEBQYIEgcRIgATFP/EABUBAQEAAAAAAAAAAAAAAAAAAAQI/8QAIhEAAQMCBgMAAAAAAAAAAAAAAgEFEgMRAAQTISIxgZHx/9oADAMBAAIRAxEAPwBAYwlnnUaw9j9Y8Xyf1S+yVJEmZaU9VLlPi8LLRNtkjYCy22fatNCBKjaMKKgIIH5GZs7tTqY+fknivsxUNADrkuPSyKpmSEM3HC7Fr++N+5oFUe+OQTozLlFMlXXsvlmT6hbKZpr14tktnDxajkRpVRBdtH+oySIbMhWu2zAjbAnVEUNSXkR6Ii+SVJ6P6P637Wa30uw+w+GS8oynKJc96bNk3syODANTHo4MtBHdbFAQWUL7dF04f2+OREdOmstiW/j77xSrk4tbc3DnXClqZYoRCIlaSXDgSoAxHbiu3SX7x//Z EndImage]]--