# Action menu

Deploy sends your current BAS file to the Maximite Control Centre for uploading to your device.

The remaining menu items are for external links.

The first is to MMBasic.exe, a DOS version of MMBasic. It is configured to use the copy that is included in the program folder.
You can change that to any other copy you have available.

After that, you can configure up to 9 external programs.
The programs will usually be configured in the Preferences window or you can edit the ini file.
Any editing of MMEdit5.ini should be done with MMEdit shut down or any changes will be lost.

In the ini file there is a section "External programs."

There are 4 fields, separated by "|"
1. The name for the menu
2. Starting path for the external program. Usually the path to the EXE or BAS file.
3. Full path to the external EXE.
4. any parameters, usually the full path to the current BAS file. The path to the MMEdit program folder is needed to tell the external program where to return any output back to.

The following place holders can be used: (either %q% or the actual quote character can usually be used.)

%bas% The full path and filename to the current BAS file.
%baspath% The path to the current BAS file folder
%extpath% The path to the external.exe (default starting folder)
%mmepath% The path to the MMEdit and MMCC program folder including trailing \
%q% = quote chr(34). you can also just use the quote character "

Examples:

Ext0 = Run in DOS | %q%%baspath%%q% | "MMBasic.exe" | %q%%bas%%q% "%mmepath%"

Run in DOS is the menu text

%q%%baspath%%q% will expand to the path to the BAS file enclosed in quotes. This is the starting folder for the external program

"MMBasic.exe" is the name of the external program. Because we are using a copy of MMBasic.exe that is in the program folder, we don't need the path. We also don't need the quotes because there are no spaces in the name but it is safer to use them by default.

%q%%bas%%q% is the name including path of the current active bas file. If needed, the file is saved before sending to the external program
"%mmepath%" is the second commandline parameter and will expand to the MMEdit program folder. Make sure there is a space between the parameters.

Example 2:

Ext1 = Test|%q%%extpath%%q%|"C:\apps\externaltest.exe" | %q%%bas%%q% "%mmepath%"

Test is the menu text

%q%%extpath%%q% becomes "C:\apps\" and is the starting folder

"C:\apps\externaltest.exe" is the external program

%q%%bas%%q% "%mmepath%" will expand to the name including path of the current active bas file followed by a space then the path to the MMEdit folder. You can use that to return the output of the external program.

The following BAS file shows how to return data to MMEdit (or send it to MMCC.exe)
Save the file and then "Run in DOS"

' external program demo
cmdline$ = MM.CMDLINE$
print cmdline$
startquote = instr(cmdline$,chr$(34))
endquote = instr(startquote+1,cmdline$,chr$(34))
inputfile$ = mid$(cmdline$,startquote+1,endquote-startquote-1)
startquote = instr(endquote+1,cmdline$,chr$(34))
endquote = instr(startquote+1,cmdline$,chr$(34))
mmeditfolder$ = mid$(cmdline$,startquote+1,endquote-startquote-1)
print
print "input file (first commandline item):"
print inputfile$
print
print "MMEdit program folder was second commandline item:"
print mmeditfolder$
for n = len(inputfile$) to 1 step -1
if mid$(inputfile$,n,1) = "\" or mid$(inputfile$,n,1) = "/" then' we have the start of filename
exit for
endif
next n
print
print "input file folder:"
inputfolder$ = left$(inputfile$,n)
print inputfolder$
open inputfolder$+"demo.bas" for output as #3
print #3, "'just a test to see if we can return a file to MMEdit"
print #3,"for n = 1 to 20"
print #3,"print n "+chr$(34)+"Hello"+chr$(34)
print #3,"next n"
close #3
print
print "SYSTEM commandline:"
print chr$(34)+mmeditfolder$+"MMEdit.exe"+chr$(34)+" "+chr$(34)+inputfolder$+"demo.bas"+chr$(34)
system chr$(34)+chr$(34)+mmeditfolder$+"MMEdit.exe"+chr$(34)+" "+chr$(34)+inputfolder$+"demo.bas"+chr$(34)+chr$(34)
end

Last edited: 30 September, 2021