| First of all, if you need to use MaxBase as it is, adding only a couple of features (like spawning an external MIDI player when the user selects an entry in a MIDI database) you can make use of plugins. A plugin is, visually, an external frame that appears after one or more records have been selected and the user pushed a button. Developing the frame is up to the programmer, while the button is put into the main MaxBase panel automatically, provided that you add two lines for every plugin in a file named plugin.ini (which must reside in the directory you launch MaxBase from): the first line is the plugin name, the second is the program to launch when the button gets pressed. If the plugin.ini file doesn't exist, you must create it. Basically a plugin is a program that, after initializing itself, gets from the caller (MaxBase) all the information it needs to do calculations and other mundane tasks. The parameters are passed with a MaxBase-To-Plugin communication via an RXFile object (RXFile is distributed with every copy of MaxBase, see RXFile home page), but you can safely reuse the following NetRexx template:
    /* A simple plug-in template */
    import nrio.RXFile

    rx = RXFile()
    rHowManyFld = Rexx
    rHowManyRec = Rexx
    rFieldName = Rexx[]
    rFieldValue = Rexx[,]
    iCount = int

    rHowManyFld = rx.linein() /* How many fields? */
    rFieldName = Rexx[rHowManyFld + 1]

    loop iCount = 1 to rHowManyFld
     rFieldName[iCount] = rx.linein() /* Get field names */
    end

    rHowManyRec = rx.linein() /* How many records? */
    rFieldValue = Rexx[rHowManyFld + 1, rHowManyRec + 1]

    loop iCount = 1 to rHowManyRec /* Records */
     loop iCount2 = 1 to rHowManyFld
      rFieldValue[iCount2, iCount] = rx.linein()
     end
    end

    /*
    Now you have:
    in rFieldName[1..rHowManyFld] all the field names.
    in rFieldValue[1..rHowManyFld, 1..rHowManyRec] all the
    records that the user has selected before calling the
    plugin, field by field and record by record.

    From now on you can write your own plug-in..
    Remember to insert it into plugin.ini, or it won't show up
    in MaxBase!
    */
NOTE: I introduced plugins when I wanted to test my RXFile library, and while plugins indeed work, they aren't very elegant (though it is the easiest way for an end user to add small features, and they can launch even native-code programs). If you need to seriously expand MaxBase capabilities you should refer to the "Java Beans" section.

Max Marsiglietti © 1997
Layout and artwork Andrea Resmini 1997