/*--------------------------------------------------------------------------------------------------- 

Hit ctrl-enter to execute.

Description:

	An example of a simple installer for scripts.

	Note: Running this script will install a small selection of example scripts into a new menu, 
	which will be present each time you start DM.  To remove this menu item (and hence the package), 
	delete the correspondinlgy 'packagename'.gtk file, replacing 'packagename' with the corresponding 
	string, situated in the plugins folder in you Digital Micrograph directory.

	Copyright © 2001 Gatan Inc.

-----------------------------------------------------------------------------------------------------*/


/* 	The InstallScript method simplifies the process slightly
	It is called with the script path, the commandname string (as it will appear in the menu),
	a menu name for the the installation (if one doesn't exist it will be created), a package 
	name (this will be the name of the generated plug-in)  */

void InstallScript( string path, string commandName, string menu, string package )
{
	// Pass 1 for isLibrary if the script is a library only and 0 to install it in the menu.	
	number isLibrary = 0
	
	// The plug-in level										 
	number level = 3	
	
	// Send a progress report to the results window.										
	result( "About to install: " + path + "\n" )				
	
	// Call the DM script function for installing files into packages
	AddScriptFileToPackage( path, package, level, commandName, menu, "", isLibrary )
																
}

// Define the menu name for the following script installations, and define the package name 
// for the following installations - they all go into the same package
string menuName = "Examples"									
string packageName = "Example Scripts"							

// Set gpath to point to the directory containing your scripts
string gpath

// This sets 'current_path' to the current directory path 													
gpath = GetSpecialDirectory(2)	

// If your scripts are in the DM directory, change "Scripts" to the script folder name								
//gpath = PathConcatenate(GetSpecialDirectory(0), "Scripts")

// Or you can use any hardcode path 
//gpath = "C:/public/scripts"  									

// Finally, call the InstallScript method with appropriate values
// Note this example will only work if your current directory (i.e. the one 
// that appears when you click open) contains the example scripts.  Else modify 
// the code accordingly
InstallScript( PathConcatenate(gpath, "Bin By 3.s"), "Rebin By 3", menuname, packageName )		
InstallScript( PathConcatenate(gpath, "Make Gaussians.s"), "Make Gaussians", menuname, packageName )
