Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    primarykey
    data
    text
    <p>nice script for the first one.</p> <p>But one error I found here</p> <pre><code>REM IF TWO PARMETERS GIVEN IF NOT "%2"=="" call :TWOPAR %1 %2 REM IF ONE PARMETER GIVEN set _OPback=%1 call :TWOPAR %_OPback:~0,1% %_OPback:~1,1% </code></pre> <p>If two parameters present, you call :TWOPAR, but it will return, so the "ONE PARMETER GIVEN" part will also be executed.</p> <p>And another general code suggestions.</p> <p>Don't repeat yourself :-)<br> If code blocks are nearly same, it is better to merge them to a function.<br> Like your two verifications of the color names for the background and forground color.</p> <pre><code>@echo off setlocal EnableDelayedExpansion if "%1"=="/?" goto HELP if "%1"=="" goto HELP goto BYPASSREMSTATEMENTS rem *********************************************************** rem * Easycolor was created by Edoctoor 2010 * rem * With the help from the good people at stackoverflow.com * rem * For the good people at stackoverflow.com * rem * * rem * Convert Color-name and Decimals Parmeters to Hex values * rem * then pass the VALUES to the COLOR COMMAND * rem *********************************************************** :BYPASSREMSTATEMENTS set "_DEBUGGING=FALSE" If "%_DEBUGGING%"=="TRUE" prompt=$g &amp;&amp; echo on &amp;&amp; cls REM IF TWO PARMETERS GIVEN IF NOT "%2"=="" call :TWOPAR %1 %2 &amp; goto :eof REM IF ONE PARMETER GIVEN set _OPback=%1 call :TWOPAR %_OPback:~0,1% %_OPback:~1,1% goto :eof rem *********************************************************** rem * Convert Color-name and Decimals Parmeters to Hex values * rem * then pass the VALUES to the COLOR COMMAND * rem *********************************************************** :TWOPAR set "_TPback=%1" set "_TPfore=%2" call :AnalyzeParam _TPback _ValidB call :AnalyzeParam _TPfore _ValidF If "%_DEBUGGING%"=="TRUE" ( echo TWOPAR Background is %_TPback% %_ValidB% echo TWOPAR Foreground is %_TPfore% %_ValidF% pause ) rem I think I can remove this as the color command rem will provide the errolevel if the values are equal... rem Is that right? rem if Background Parameter matches Foreground ignore rem IF "%_TPback%"=="%_TPfore%" ( rem set _TrueIFMatch=%errorlevel% rem exit %_TrueIFMatch% rem ) if "%_ValidB%"=="TRUE" ( if "%_ValidF%"=="TRUE" ( color %_TPback%%_TPfore% ) ) exit /B :AnalyzeParam &lt;paramVariable&gt; setlocal EnableDelayedExpansion set "value=!%1!" set "valid=FALSE" set "color[0]=Black" set "color[1]=Blue" set "color[2]=Green" set "color[3]=Aqua" set "color[4]=Red" set "color[5]=Purple" set "color[6]=Yellow" set "color[7]=White" set "color[8]=Gray" set "color[9]=LightBlue" set "color[10]=LightGreen" set "color[11]=LightAqua" set "color[12]=LightRed" set "color[13]=LightPurple" set "color[14]=LightYellow" set "color[15]=BrightWhite" for /L %%n in (0,1,15) DO ( if /I !color[%%n]!==!value! ( set "value=%%n" set "valid=TRUE" goto :AnalyzeParam_valid ) ) rem Test if it is a legal hex nibble character if /I !value! GEQ A ( if !value! LEQ F ( set "valid=TRUE" ) ) ELSE if !value! GEQ 0 ( if !value! LEQ 9 ( set "valid=TRUE" ) ) :AnalyzeParam_valid ( ENDLOCAL set %~1=%value% set %~2=%valid% goto :eof ) </code></pre> <p>hope it helps jeb</p>
    singulars
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. VO
      singulars
      1. This table or related slice is empty.
    2. VO
      singulars
      1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload