MODULE GLOBAL interpret { global filename$="notes.txt" declare FreeConsole lib "Kernel32.FreeConsole" declare GetStdHandle lib "Kernel32.GetStdHandle" {long a} declare AttachConsole lib "Kernel32.AttachConsole" {long a} declare CloseHandle lib "Kernel32.CloseHandle" {long a} declare global WriteCons Lib "Kernel32.WriteConsoleW" {long cons, a$, long n, Long p, long u} long STD_OUTPUT_HANDLE=-11 global retvalue buffer clear retvalue as long ret=AttachConsole(-1) if ret=0 then beep: exit global m=GetStdHandle(STD_OUTPUT_HANDLE) if not islet then try { open "notes.bat" for output as #f print #f, {@}+appdir$+{m2000.exe data {%*}: dir %cd%:load notes } close #f } PrintConsoleLn("") dos "notes.bat" else read cmd$ cmd$=trim$(cmd$) if cmd$="" then if exist(filename$) then open filename$ for wide input exclusive as #f while not eof(#f) line input #f, line$ PrintConsoleLn(line$) end while close# end if else if exist(filename$) then try ok { open filename$ for wide append exclusive as #f } else try ok { open filename$ for wide output exclusive as #f } end if if ok then print #f, str$(now+today,"YYYY-MM-DD hh:mm:ss") print #f, chr$(9);@RemoveSpaces$(cmd$) close#f end if end if end if call void closehandle(m) call void freeconsole() Sub PrintConsole(a$) Call Void WriteCons(m, a$, Len(a$), retvalue(0), 0) End Sub Sub PrintConsoleLn(a$) a$+={ } Call Void WriteCons(m, a$, Len(a$), retvalue(0), 0) End Sub Function RemoveSpaces$(a$) local b$,c$,i, sk for i=1 to len(a$) b$=mid$(a$,i,1) if sk then c$+=b$ if b$=""""then sk=false b$=mid$(a$,i+1,1) if b$<>"" and b$<>" " then c$+=" " end if else.if mid$(a$,i,2)<>" "then c$+=b$:if b$=""""then sk=true end if next =c$ End Function } module interpret1 { try {interpret} } interpret1: end