The Tools Menu and Running External Commands
The Tools menu contains items added by 'ExternalTool' entries in the SerialEMproperties.txt file. This page describes how to add such entries, but has no information on the specific commands that you may see there. The entries in the properties file for specifying the command to run and its arguments, 'ToolCommand' and 'ToolArguments', have the same format as the script commands for starting an external process, 'CreateProcess' and 'NextProcessArgs', respectively.
Selecting an entry in this menu, or running the 'CreateProcess' command, will start the external program, but SerialEM will not wait for it to exit.
The command entry
The command entry specifies the program to run. It can be an executable program, or it can be a DOS batch file with extension '.bat' or '.cmd'. It should not be enclosed in quotes even it contains spaces, as SerialEM will automatically wrap it in quotes. The extension '.exe' may be omitted on any executable ending in that, but otherwise the extension must be included. For .'bat' and '.cmd' files, the program knows how to run these with 'cmd.exe'; for any other kind of script, the script interpreter (e.g., 'python.exe') must be entered for the command, and the script name must be entered as an argument. The command name alone will work if the program is on the search path (i.e., the PATH variable), but otherwise the full path to the executable must be given. The full path to a batch file should be entered unless the file is in the current directory, which will not be the case in general.
The arguments entry
This entry specifies a list of arguments to be supplied when running the command. If a single argument such as filename might contain spaces, it should be enclosed in double quotes (single quotes will not work). When running from script, the arguments can include variables that are evaluated (but not arithmetic expressions). This is obviously not an option for Tools menu entries, but both kinds of argument lists can contain special keywords that will be substituted with a value. These keywords are
The keyword can be embedded in a longer string. The whole 'word' (set of characters not containing a space) containing the keyword will be enclosed in quotes automatically, as long as there is no double quote at either end of the word. If you are following the current directory, for example, with a filename that might have spaces, you should put quotes around the '%curdir%' and filename yourself to prevent quotes from being in the wrong place.
ExternalTool Open Mdoc File ToolCommand 1 notepad ToolArguments 1 %imagefile%.mdoc ExternalTool Open Nav File ToolCommand 2 notepad ToolArguments 2 %navfile% ExternalTool 3dmod Image File ToolCommand 3 C:\Program Files\3dmod\3dmod ToolArguments 3 %imagefile%These property entries will put three entries in the Tools menu. The first will open the '.mdoc' file associated with the current image file in Notepad; the second will open the Navigator file in Notepad, and the third will open the current file in 3dmod, installed from the standalone 3dmod package.