Reply to thread

I write a new plugins MyScript (internal name: MyScript2 to avoid conflict..., very very alpha build...).


Download here and extract in process plugin folder.



When MP start, MyScript enumerates all *.cs 'script' file found in <home>plugins\process\MyScript, and for each

script, compile it in dynamic assembly, add all assembly references that MyScript have, create an instance and run.


Press 'Ctrl+S' inside MP to rebuild all scripts with feedback.

All feedback are logged.


The only script sample is:


[code]

using System;

using MediaPortal.MyScript;

using MediaPortal.GUI.Library;

using MediaPortal.Dialogs;


class Sample1

{

    public void Main()

    {

            Log.Write("A log message from script...");

           

            GUIWindowManager.OnNewAction += new OnActionHandler(GUIWindowManager_OnNewAction);           

  }

 

  private void GUIWindowManager_OnNewAction(Action action)

    {

            if (action.wID == Action.ActionType.ACTION_KEY_PRESSED)   

            {

                if(action.m_key.KeyChar == 26)

                {               

                  GUIDialogOK dlgOk = (GUIDialogOK)GUIWindowManager.GetWindow((int)GUIWindow.Window.WINDOW_DIALOG_OK);

                    dlgOk.SetHeading("MyScript2");

                    dlgOk.SetLine(1,"A messagebox from script when press Ctrl+Z...");

                    dlgOk.DoModal(GUIWindowManager.ActiveWindow);

                }

            }

    }

}

[/code]


that show a message when user press Ctrl+Z.




Tomtom21000 : A more powerful version can be a better replacement of actual MyScript?


The problem is that only people that know the code can write a script, so why a developer need to use this script features if can

simply create a process plugin directly?


For me, all script file must be derived from a base class that contains simple and generic method (like the method described in first post),

that allow interaction with other components (core and other plugins) in a safe and more simply mode, and allow

creating a 'wizard/macro' frontend for creating very simple script...


Enjoy!



Added..

I post the plugin in a new thread in correct forum to preserve the discussion here about the "conceptional" design...


Top Bottom