How to include a menu entry for your Third Party program in Manipulate


An obvious choice would of course be to edit the main menu by hand to include an option to allow users to run your third party program from within Manipulate. However in order to make life a little easier there is a module for such a thing. Simply add the relevant code to the file .progs/modules/oapp/menu and when a user uses Manipulate they will be able to access this menu.

Sample programs are given in the module, these can of course be removed. The script will only let a user run a command that they would be able to do so from a shell, they are not able to assume root privileges unless they are logged in as such (indeed su has already been disabled).

The variable USER_FREE is defined within the configuration file and enables a system administrator to decide whether or not users should be allowed to define the program they wish to run.

The code you need to add to the menu file is simply a menu entry and an if statement to define what to run when the user selects your program.

echo "4)  My program"

Should be added at the appropriate place in the menu, please try to preserve alphabetical and numerical order.
 Please also note that menu entries q, 1, 2 and c are reserved. Please do not attempt to define a menu entry with these variables. They already exist within the module and in the interests of maintaining a consistent interface please leave these as they are.

somewhere after the read selection2 line please enter the following (adjust to your needs)

if [ "$selection2" == "4" ]
then
myprogram
wait 2
mainmenu
fi

Obviously in both examples the number 4 can be changed to whatever is available so long as the values match in both the menu entry and the if statement. myprogram in the If block should be replaced with the command used to launch your program.
Wait 2 is optional though I do recommend that you add it in.
Please ensure that you remember to call the mainmenu function at the end of your If statement.

Note: Whilst the menu is case sensitive please try and avoid using case to distinguish between your command and another in the menu. It is likely to confuse many users.