Action menu


Deploy sends your current BAS file to the Maximite Control Centre for uploading to your device.
The right-hand toolbar button is a shortcut to 'Deploy'

MMReplace (sub-menu):  MMReplace is an external program written and maintained by Gerry, aka  disco4now on TheBackShed. Amongst other things, it allows you to replace long variables with short ones saving memory on constrained systems.

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.

"Edit list..." will bring up the Preferences dialog to allow editing or adding links to external programs.

Select the next available page with the spinwheel and enter the appropriate settings. The above example is for MMB4W. Your path to the exe will be different.

By default, the 'run' button (gear with green arrow) is set to run the first action in the menu after 'deploy'
In Windows, you can change that to any other menu item by holding down the shift key while selecting the item.
In Linux (and Windows), the default item can be selected by clicking "Set as default"

If your external program has problems with the starting folder, select "Use batch file"
This uses a simple batch file to CD to the selected Starting folder before calling the external program.
0 = no batch file, 1 = standard batch file to CD to the correct folder, 2 = close any running MMB4W before running BAS program., 3 = another standard batch file to CD to the correct folder

Other Operating System users will have to use the Preferences popup or edit the "External hot link" item in MMEdit5.inf.
Any editing of MMEdit5.ini should be done with MMEdit shut down or any changes will be lost.

That item can now be actioned with the 'run' button.

The following place holders can be used: (either %q%, ' single quote, or the actual quote character can usually be used.)
Double quotes will be changed to %q% while single quotes will remain as is and converted on the fly when needed. This makes for easier reading.

 %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 command line 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: 24 July, 2023