variables calling from external two batch files

Discussion forum for all Windows batch related topics.

Moderator: DosItHelp

Post Reply
Message
Author
nnnmmm
Posts: 117
Joined: 26 Aug 2017 06:11

variables calling from external two batch files

#1 Post by nnnmmm » 27 Sep 2022 07:38

Code: Select all

!BOXX-LIB.BAT has

CALL :%1 %*
EXIT /B

:WhichResScaler
(@ECHO OFF
   Setlocal EnableDelayedExpansion
   REM 3 IN, 3 OUT - Which resolution Scaler?

   SET VAR1=!%2!
   SET VAR2=!%3!
   SET VAR3=!%4!
   REM --------------------
   IF /I !VAR1!==0 SET WW=windowresolution=
   IF /I !VAR1!==1 SET WW=windowresolution=800x600
   IF /I !VAR1!==2 SET WW=windowresolution=867x650
   IF /I !VAR1!==3 SET WW=windowresolution=1024x768
   IF /I !VAR1!==4 SET WW=windowresolution=1200x900
   IF /I !VAR1!==5 SET WW=windowresolution=1256x947
   IF /I !VAR1!==O SET WW=windowresolution=original
   SET W11=!WW!

   IF /I !VAR2!==0 SET WW=windowresolution=
   IF /I !VAR2!==1 SET WW=windowresolution=800x600
   IF /I !VAR2!==2 SET WW=windowresolution=867x650
   IF /I !VAR2!==3 SET WW=windowresolution=1024x768
   IF /I !VAR2!==4 SET WW=windowresolution=1200x900
   IF /I !VAR2!==5 SET WW=windowresolution=1256x947
   IF /I !VAR2!==O SET WW=windowresolution=original
   SET W12=!WW!
   REM --------------------
   SET WW=scaler=!VAR3!
   IF /I !VAR3!==1 SET WW=scaler=normal2x
   IF /I !VAR3!==2 SET WW=scaler=normal3x
   IF /I !VAR3!==3 SET WW=scaler=advinterp2x
   IF /I !VAR3!==4 SET WW=scaler=advmame2x
   IF /I !VAR3!==5 SET WW=scaler=hq2x
   SET W21=!WW!

)
(Endlocal 
   SET %5=%W11%
   SET %6=%W12%
   SET %7=%W21%
)
EXIT /B
*********************************************

Code: Select all

!BOXX-LIB - WhichResScaler.BAT has

@ECHO OFF

SET V1=%1
SET V2=%2
SET V3=%3

CALL "C:\DOSBox-X\!BOXX-LIB.BAT" :WhichResScaler V1 V1 V2 W11 W12 W21
ECHO.
ECHO inputs
ECHO %V1% %V2% %V3%
ECHO.
ECHO outputs
ECHO %W11%
ECHO %W12%
ECHO %W21%
ECHO.
PAUSE
*********************************************

Code: Select all

!BOXX-LIB - WhichResScaler - RUN.BAT has

CALL "!BOXX-LIB - WhichResScaler.BAT" 3 4 2
I expect the answers to be
windowresolution=1024x768
windowresolution=1200x900
scaler=normal3x

but instead it gives me the wrong answers as below
windowresolution=1024x768
windowresolution=1024x768
scaler=advmame2x

please let me know what i am doing wrong, this batch is a little urgent to me to finish 100's DOS game batch files.

OJBakker
Expert
Posts: 88
Joined: 12 Aug 2011 13:57

Re: variables calling from external two batch files

#2 Post by OJBakker » 27 Sep 2022 10:08

Change

Code: Select all

CALL "C:\DOSBox-X\!BOXX-LIB.BAT" :WhichResScaler V1 V1 V2 W11 W12 W21
to

Code: Select all

CALL "C:\DOSBox-X\!BOXX-LIB.BAT" :WhichResScaler V1 V2 V3 W11 W12 W21

nnnmmm
Posts: 117
Joined: 26 Aug 2017 06:11

Re: variables calling from external two batch files

#3 Post by nnnmmm » 27 Sep 2022 10:20

oh man! V1 V1 V2, i could not believe this nonsense mistake that i made, i couldnt find what was wrong for a whole day. thanks for your help, you were a life saver

Post Reply