Σάββατο 29 Οκτωβρίου 2022

Running M2000 from alternative version

 You can use M2000.exe which a specific M2000.dll and an info.gsb and help2000utf8.dat in a folder say C:\Users\personAny\FolderM2000\

The M2000.exe compiled from mexe.vbp (open mexe.vbp in VB6)

The M2000.exe if has a link to execute then check if M2000.dll is in the same folder load this. Without a link M2000.exe start the register M2000.dll to system, but if not found as registered then open the file as local active-X using NewObjectFromActivexDll() function in ActiveX.bas or module2. To follow the code, see Sub Main in Module1, which define Dim mm As New RunM2000, and then call mm.doit


If you want to run mexe.vbp and m2000.vbp (which make the dll) at the same time, you can...But before load the M2000.vbp change from menu tools\options\edit format\ all text font as Courier New Greek. So the greek letters now  (from reserved words) can be seen. So now you can run both, and you can set breakpoints. Although you can't call m2000.exe second time when m2000.dll run from IDE, because hang. M2000dll can run multiple times (one time for each runnning m2000.exe) when is on compiled form.


Let say that you want to work on a folder c:\temp, and the folder exist (if not make it from explorer).

Open cmd and change dir to c:\temp using cd c:\temp

**batch file in a working directory

We want two commands, the %RunM2000% and the %M2000module%. The first run a gsb file, here the test2. We can put statements for execution, like the calling module, and the End statement to termiante the environment. If the test2.gsb has B:End as last line (not in a module) then these statements executed and not need to pass them from call from %RunM2000%. The second we use when we want a module from info.gsb (which we place in the user folder (if we use dir user statement), or in the m2000.exe folder (if we use dir appdir$ statement). See Setting of %M2000module% bellow.


So lets make the batch file (

notepad setM2000.bat

Now copy the four lines ahead but change the actual folder of M2000dir

set "M2000dir=C:\Users\personAny\FolderM2000\"
set "M2000=%M2000dir%M2000.EXE dir %cd%"
set "RunM2000=%M2000%:load "
set "M2000module=%M2000%:d123$=dir$:dir user:load modules info.gsb:dir d123$:clear:"


Save the file and now run the batch:

setM2000


**Open mEditor form info at current directory

%M2000module%meditor


**file test2.gsb

You can make this file using Notepad test2.gsb, save it as utf8 (which is the first choise for Notepad). Or ypu can make this from M2000 Editor (which will be run using the statement above).

module b {
print command$
input "A=", A
input "B=", B
print  A*B
print "ok"
push key$: drop
}

You can run the file from meditor (but make a test1234.gsb, which include a copy of the statements of the opened file and run this). Or you save the file as Test2 and run from the cmd using this

**Run test2.gsb calling b and then end program

%RunM2000%test2:B:End

The final test2.gsb version may have the B: End statements at the last line.


Δεν υπάρχουν σχόλια:

Δημοσίευση σχολίου

You can feel free to write any suggestion, or idea on the subject.