Create real Console mode programs in SB

Pappa Lapub 191 Reputation points

about create-real-console-mode-programs-in-sb

there's an other way to build a CLI App in SB with AMC_patcher-CLI

instead of AppModeChange.exe GUI in one go.

So the essential lines in a eg. SB12Comp.bat file would be like

supposed that:
AMC.exe is anywhere in your %PATH%
%SB12% stands for your SB projects folder, where the .sb files are stored
Also adjust the the path for eg,
C:\Program Files (x86)\Microsoft\SmallBasic12\SmallBasicCompiler.exe to the path, where your SBCompiler is stored.

:: AppModeChanger patcher - CLI  
IF "%~1"=="" GOTO Syntax  
IF "%~1"=="-?" GOTO Syntax  
IF "%~1"=="/?" GOTO Syntax  
IF /I "%~1"=="-h" AMC.EXE & COLOR & GOTO :EOF  
IF NOT EXIST "%~f1" ECHO File "%~1" NOT found! & GOTO :EOF  
IF /I NOT "%~x1"==".sb" ECHO NO .sb source file given! & GOTO :EOF  
IF /I NOT "%~dp1"=="%SB12%\" ECHO Source file NOT in SB12 project folder! & GOTO :EOF  
ECHO %~ftza1  
@"C:\Program Files (x86)\Microsoft\SmallBasic12\SmallBasicCompiler.exe" "%~f1"  
:: OK	: 0 errors.  
:: ERR	: xx errors.  
IF NOT EXIST "%~dpn1.exe" ECHO Compilation ERROR! && GOTO :EOF  
ERASE /F "%~dpn1.pdb"  
IF "%~2"=="3" @AMC.EXE "%~dpn1.exe" 3  
IF /I "%~2"=="cui" @AMC.EXE "%~dpn1.exe" 3  
ECHO Compiles .sb files to .exe under SB12, as GUI (Default) or CUI App (SBConsole).  
ECHO Usage %~nx0  [Path\] [Mode]  [-?,/?]  
ECHO ------- Mode: 2..GUI (Default), 3..CUI, uso. (s. amc.exe /?)  
ECHO         -h     Shows orig. Help about amc.exe.  

Since SB12 the used TextWindow command works different as in SB11, when you use a ConsoleHost like ConsoleZ, (Console2) etc. and the CUI App will fall out of the Console window.

To avoid this i compiled a SBConsole extension to be used instead of TextWindow commands:
So like:

SBConsole commands are like TextWindow commands, but will stay in the ConsoleHost as a real CLI app.
If you only use a simple CMD window you dont need this and can further use TextWindow commands for a console application. (6.49KB)
(you'll need to translate the xml tag infos to your language)

A programming language created by Microsoft that serves a stepping stone for beginners from block-based coding languages to more complex text-based languages.
272 questions
{count} votes