who can Convert bat to pas

@echo off
if not exist a:pascal_pgmin md a:pascal_pgmin
if not exist a:pascal_pgmsource md a:pascal_pgmsource
if not exist a:pascal_pgmfpcrun.bat copy c:ppinfpcrun.bat a:pascal_pgm
cls
if (%1)==() goto errmsg
if exist a:pascal_pgmsource%1.ow del a:pascal_pgmsource%1.ow
if exist a:pascal_pgmin%1.exe del a:pascal_pgmin%1.exe
c:
cls
cd ppinwin32
fpc a:pascal_pgmsource%1.pas
cd emp
echo !
pause
if exist a:pascal_pgmsource%1.exe copy a:pascal_pgmsource%1.exe a:pascal_pgmin > nul
if exist a:pascal_pgmsource%1.exe del a:pascal_pgmsource%1.exe
if exist a:pascal_pgmsource%1.ow del a:pascal_pgmsource%1.ow
cls
if exist a:pascal_pgmin%1.exe a:pascal_pgmin%1
goto end
:errmsg
echo No pascal source file is specified!
echo The correct format is : fpcrun filename
:end
a:
cd

Comments

  • Here is some code, to get the units, just e-mail me.

    [code]

    USES DosPlus, CrtPlus, Dos;

    VAR R : SearchRec;

    BEGIN
    NormalCursor; SetCursorPos(3,1);TColor(7,0); Clear;
    TColor(0,14); TMkSpace(1,TScreenSize.X, 1);
    TCenter('Script to compile FPC programs. -- DexterMagnific@yahoo.fr --',1);
    TColor(7,0);

    FindFirst('a:pascal_pgmin*.*', R);
    IF DosError <> 0 THEN NewDir('a:pascal_pgmin');
    FindFirst('a:pascal_pgmsource*.*', R);
    IF DosError <> 0 THEN NewDir('a:pascal_pgmsource');
    FindFirst('a:pascal_pgmfpcrun.bat', R);
    IF DosError <> 0 THEN CopyFile('c:ppinfpcrun.bat','a:pascal_pgmfpcrun.bat');

    IF ParamStr(1) = '' THEN BEGIN
    TOutText('No Pascal source file is specified !'#13#10);
    TOutText('The correct format is : FPCRun FileName (without extension)'#13#10);
    Halt(255);
    END;

    FindFirst('a:pascal_pgmsource'+ParamStr(1)+'.ow', R);
    IF DosError = 0 THEN DeleteFile('a:pascal_pgmsource'+ParamStr(1)+'.ow');
    FindFirst('a:pascal_pgmin'+ParamStr(1)+'.ow', R);
    IF DosError = 0 THEN DeleteFile('a:pascal_pgmin'+ParamStr(1)+'.ow');

    SwapVectors;
    Exec('c:ppinwin32fpc.exe','a:pascal_pgmsource'+ParamStr(1)+'.pas');
    SwapVectors;

    TColor(7,0);
    TOutText('[Back to Script. Press any key ...]'#13#10);
    WaitForKey;

    FindFirst('a:pascal_pgmsource'+ParamStr(1)+'.exe', R);
    IF DosError = 0 THEN BEGIN
    CopyFile('a:pascal_pgmsource'+ParamStr(1)+'.exe','a:pascal_pgmin'+ParamStr(1)+'.exe');
    DeleteFile('a:pascal_pgmsource'+ParamStr(1)+'.exe');
    END;
    FindFirst('a:pascal_pgmsource'+ParamStr(1)+'.ow', R);
    IF DosError = 0 THEN DeleteFile('a:pascal_pgmsource'+ParamStr(1)+'.ow');

    FindFirst('a:pascal_pgmin'+ParamStr(1)+'.exe');
    IF DosError = 0 THEN Exec('a:pascal_pgmin'+ParamStr(1)+'.exe','');

    TColor(10,0);
    TOutText('Script job finished'#13"10);
    TOutText('Program made by DexterMagnific'#13#10);
    TColor(7,0);
    END.

    [/code]


    DexterMagnigfic at yahoo.fr

  • [b][red]This message was edited by DexterMagnific at 2003-2-11 5:58:53[/red][/b][hr]
    e-mail me to get the units

    [code]

    USES DosPlus, CrtPlus, Dos;

    VAR R : SearchRec;

    BEGIN
    NormalCursor; SetCursorPos(3,1);TColor(7,0); Clear;
    TColor(0,14); TMkSpace(1,TScreenSize.X, 1);
    TCenter('Script to compile FPC programs. -- DexterMagnific@yahoo.fr --',1);
    TColor(7,0);

    FindFirst('a:pascal_pgmin*.*', R);
    IF DosError <> 0 THEN NewDir('a:pascal_pgmin');
    FindFirst('a:pascal_pgmsource*.*', R);
    IF DosError <> 0 THEN NewDir('a:pascal_pgmsource');
    FindFirst('a:pascal_pgmfpcrun.bat', R);
    IF DosError <> 0 THEN CopyFile('c:ppinfpcrun.bat','a:pascal_pgmfpcrun.bat');

    IF ParamStr(1) = '' THEN BEGIN
    TOutText('No Pascal source file is specified !'#13#10);
    TOutText('The correct format is : FPCRun FileName (without extension)'#13#10);
    Halt(255);
    END;

    FindFirst('a:pascal_pgmsource'+ParamStr(1)+'.ow', R);
    IF DosError = 0 THEN DeleteFile('a:pascal_pgmsource'+ParamStr(1)+'.ow');
    FindFirst('a:pascal_pgmin'+ParamStr(1)+'.ow', R);
    IF DosError = 0 THEN DeleteFile('a:pascal_pgmin'+ParamStr(1)+'.ow');

    SwapVectors;
    Exec('c:ppinwin32fpc.exe','a:pascal_pgmsource'+ParamStr(1)+'.pas');
    SwapVectors;

    TColor(7,0);
    TOutText('[Back to Script. Press any key ...]'#13#10);
    WaitForKey;

    FindFirst('a:pascal_pgmsource'+ParamStr(1)+'.exe', R);
    IF DosError = 0 THEN BEGIN
    CopyFile('a:pascal_pgmsource'+ParamStr(1)+'.exe','a:pascal_pgmin'+ParamStr(1)+'.exe');
    DeleteFile('a:pascal_pgmsource'+ParamStr(1)+'.exe');
    END;
    FindFirst('a:pascal_pgmsource'+ParamStr(1)+'.ow', R);
    IF DosError = 0 THEN DeleteFile('a:pascal_pgmsource'+ParamStr(1)+'.ow');

    FindFirst('a:pascal_pgmin'+ParamStr(1)+'.exe');
    IF DosError = 0 THEN Exec('a:pascal_pgmin'+ParamStr(1)+'.exe','');

    TColor(10,0);
    TOutText('Script job finished'#13"10);
    TOutText('Program made by DexterMagnific'#13#10);
    TColor(7,0);
    END.

    [/code]
    DexterMagnigfic at yahoo.fr



Sign In or Register to comment.

Howdy, Stranger!

It looks like you're new here. If you want to get involved, click one of these buttons!

Categories

In this Discussion