View unanswered posts | View active topics It is currently 21 Oct 2014 05:57



Post new topic Reply to topic  [ 47 posts ]  Go to page 1, 2, 3, 4  Next
RCG needs help with possible poison characters (getting clos 
Author Message

Joined: 21 Dec 2011 14:21
Posts: 76
Post RCG needs help with possible poison characters (getting clos
I created a RCG, nothing new there as they are a dime a dozen. But i need help on getting the Extended Character Set (as well as the Special) to generate properly. it breaks when using "E" or "S" for the character set, but all the others; A, AN, H, N work as designed.
you can run the program either by:
1) typing in Rand7
and use E or S for the CharSet
or
2) typing in Rand7 4 4 4 E N

There are two other places that could look nicer :shock: , these are:
1) if defined rand16 set Result!maxcount!= found at the outerend loop
and
2) if defined result%%a if "%1"=="/s" endlocal & found at the end loop

i was able to put the #2 in a for /L loop but couldn't fathom a way to condense it further
trying to put #1 in a for /L loop didn't work at all. i would appreciate any help on making these more succinct code even though it works as it is.

note: i did write a basic program that worked on all characters but the double quote and wanted to achieve the same with a batch file.

idea's or thoughts?

rand7
Code:
@echo off
echo.

set QtySets=&set CharSet=&set SepStat=&set SepChar=&set ByteCount=&set MaxLoop=
set result1=&set result2=&set result3=&set result4=&set result5=&set result6=
set result7=&set result8=&set result9=&set result10=&set result11=&set result12=
set result13=&set result14=&set result15=&set result16=
set maxcount=0&set count=0

setlocal EnableExtensions EnableDelayedExpansion

if "%1"=="" goto :askque4

if /i "%1"=="/h" goto :help
if    "%1"=="/?" goto :help
if /i "%1"=="/s" goto :askque4

:: Maxloop QtySets ByteCount CharSet SepStat but not SepChar
   if "%1" GTR 0 if "%2" GTR if "%3" GTR 0 if not "%4"=="" if not "%5"=="" (
         set MaxLoop=%1
         set QtySets=%2
         set ByteCount=%3
         set CharSet=%4
         set SepStat=%5
         goto :initset
   )
      
goto :askque4

:help
echo %0 will create a block of random code based on your input.
echo.
echo The program will ask for character set, loop count, byte size and repeat byte.
echo.
echo The max for loop count  is 64
echo The max for byte size   is 16
echo The max for repeat byte is 16
echo.
echo Thus the max block size is 16K, you will need to extend the DOS console
echo session so that the screen buffer width is 250 or greater, so that will
echo fit the entire block on a page. You will need to be able to scroll to
echo capture the entire block. Remember to press Enter to complete the copy.
echo.
echo The character set can be one of the following:   Unique Key's
echo ________   ___________________________________ ____________
echo.
echo Alpha    - Upper and Lower Case A-Z, a-z   ^(52^)
echo Extended - Alpha + Number + Special Characters   ^(93^)
echo Hex    - Hexadecimal A-Z,0-9         ^(16^)
echo Number    - Numbers 0-9            ^(10^)
echo AlphaNum - AlphaNumeric A-Z, a-z, 0-9      ^(62^)
echo.
echo This program will produce ^("to the best of its known abilites"^) completely
echo random code.
echo.
echo The default charcter set is Hex, Loop Count, Byte Size and Repeat Byte is 4. 
echo This is a 64 byte block of random code to use as you deem fit.
echo Max possibilites 1.157920892373162e+077
echo.
echo Tip: You can use the Edit-^>Mark command of the console to mark a block of text,
echo hit enter to save selected text. Then you can paste into another document or
echo program.
echo.
echo Tip: Set the properties of the CMD.EXE to Quick Edit mode. Then mark text with
echo Left click and Drag, Right click to copy selected text. Paste to document or
echo program.
echo.
echo Tip: to save the result(s) to the environment table, use the /s switch. Type
echo "SET result" to view the ouptut of %0. Note: Running a subsuquent %0
echo without the /s switch will clear the previous output to the environment table.
echo.
echo The Author ^(and other Distributers^) of this software will not be held 
echo responsible for any damages caused by said software. The is no warranty,
echo implied or otherwise. Tbis is to be used for your education of Random Code
echo Generator's.
goto :eof

:askque4
:: find out which character set to use
echo CharSet(Possibilities)   Expanded
echo ======================   ====================================
echo Alpha^(52^)       A-Z, a-z
echo AlphaNumeric^(62^)    A-Z, a-z, 0-9
echo Extended^(93^)      A-Z, a-z, 0-9, All exc "^!","%%"
echo Hex^(16^)         A-F, 0-9
echo Numbers^(10^)      0-9
echo Special^(33^)      All exc "^!","%%"
echo.
set /p CharSet=Choose Character Set [A^/AN^/E^/H^/N^/S] ^<H^>
echo.
if "%CharSet%"=="" set CharSet=H
if /i not "%CharSet%"=="A" if /i not "%CharSet%"=="E" if /i not "%CharSet%"=="H" if /i not "%CharSet%"=="N" if /i not "%CharSet%"=="AN" if /i not "%CharSet%"=="S" goto :askque4

:askque3
:: how many time to repeat random request
set /p MaxLoop=How many times to repeat selection? [1-64] ^<4^>
echo.
if "%MaxLoop%"=="" set MaxLoop=4
if %MaxLoop% GTR 0 if %MaxLoop% LSS 65 goto askque2
echo.
echo %MaxLoop% not in the expected range [1-16]
echo.
goto askque3

:askque2
:: get the amount of characters to display per string
set /p byteCount=How many digits do you want to display per pair? [1-16] ^<4^>
echo.
if "%byteCount%"=="" set byteCount=4
if %byteCount% GTR 0 if %byteCount% LSS 17 goto askque1
echo.
echo %byteCount% not in the expected range [1-16]
echo.
goto askque2

:askque1
:: get the amount of %byteCount% byte pairs to be generated and displayed
set /p QtySets=How many sets of %byteCount% do you want to generate? [1-16] ^<4^>
echo.
if "%QtySets%"=="" set QtySets=4
if %QtySets%  GTR 0 if %QtySets% LSS 17 goto :askque5
echo %QtySets% not in the expected range [1-16]
echo.
goto askque1

:askque5
:: ask about seperator usage
set /p SepStat=Use a seperator between sets? [Y-N] ^<N^>
echo.
if    "%SepStat%"==""  set SepStat=N & goto :initset
if /i "%SepStat%"=="Y" set SepStat=Y & goto :askque6
if /i "%SepStat%"=="N" set SepStat=N & goto :initset
goto :askque5

:: ask about type of seperator
:askque6
set /p SepChar=Use a Dash or Space as delimiter? [D-S] ^<S^>
echo.
if    "%SepChar%"==""  set SepChar=S & goto :initset
if /i "%SepChar%"=="S" set SepChar=S & goto :initset
if /i "%SepChar%"=="D" set SepChar=D & goto :initset
goto :askque6

:: loop to create string value; character setLoop Count, ByteCount RepeatByte
:: eg.  519B or 6C2B0A or 0F14A28CD or AlFGHJdKaceD, etc...
:initset
REM if /i "%1"=="/repeat" echo \%QtySets%\ /%SepStat%/ \%ByteCount%\ /%Maxloop%/ \%CharSet%\
REM echo \!CharSet!\ /!Maxloop!/ \!ByteCount!\ /!QtySets!/ \!SepStat!\
   :: make the SPECIAL characters
   :: note: some ommited, see end of list - "RESERVED"
   :: make the A-Z characters
   :: make the a-z characters
   :: make the 0-9 characters
   set n=0123456789
   set h=ABCDEF0123456789
   set a=abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ
   set an=abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789
   set "e=abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789~`@#$^&:;_/.,^*^-^+^=^\^|^]^[^{^}^'^?^(^)^<^>^ ^^^""
   set "s=^~^`^@^#^$^^^&^:^;^_^/^.^,^*^-^+^=^\^|^]^[^{^}^'^?^(^)^<^>^ ^^^""
   rem SPACE appears to work but not yet tested fully, appears in CharSet after the ^>
   SET "RESERVED1=^ "
   rem the two reserved characters do not work, how to get them to work?
   SET "RESERVED2=^!"
   SET "RESERVED3=^%"
   :: unrem to see the extended set
   REM echo %e%
   :: unrem to see the special set
   REM echo %s%
   :: set random to eval
   set /a eval1=%random% %% 10
   set /a eval2=%random% %% 16
   set /a eval3=%random% %% 52
   set /a eval4=%random% %% 62
   set /a eval5=%random% %% 93
   set /a eval7=%random% %% 32

   
   set /a eval6=%Maxloop% * %byteCount% * %QtySets%
if %Maxloop% GTR 1 (echo Generating a block size of %eval6% characters) else (
   echo Generating a string size of %eval6% characters)
   echo.
:maxloop
REM echo off
REM pause > nul | echo Breakpoint1
set /a maxcount=%maxcount% + 1
   :continue
   set outercount=0
      :outrloop
      set /a outercount=!outercount! + 1
      set count=0
         :innrloop
         set /a count=count + 1
         :: get return of random mod based on CharSet
         :: Has NOT Passed Range Testing
         :: set the character set
         :askque7
         :: goto CharSet and get random character
         if /i "%CharSet%"=="A"  set /a eval3=%random% %% 52 & set randval=!a:~%eval3%,1!  & goto :charstsk
         if /i "%CharSet%"=="E"  (
            set /a eval5=%random% %% 92
            if !eval5! LEQ 62 set randval=!an:~%eval5%,1! & goto :charstsk
            if !eval5! GTR 62 set /a eval5=!eval5! * 2 - 125
            set randval=!s:~%eval5%,1!
         ) & goto :charstsk
         if /i "%CharSet%"=="H"  set /a eval2=%random% %% 16 & set randval=!h:~%eval2%,1!  & goto :charstsk
         if /i "%CharSet%"=="N"  set /a eval1=%random% %% 10 & set randval=!n:~%eval1%,1!  & goto :charstsk
         if /i "%CharSet%"=="AN" set /a eval4=%random% %% 62 & set randval=!an:~%eval4%,1! & goto :charstsk
         if /i "%CharSet%"=="S"  set /a eval6=%random% %% 32 & set randval=!s:~%eval7%,1!  & goto :charstsk
         goto askque7
         :charstsk
         :: sets the nth character of randval
         set  randval_!count!=!randval:"=!
         if !count!==%byteCount% goto innrend
         goto innrloop
      :innrend
      set Rand!outercount!=%randval_1%%randval_2%%randval_3%%randval_4%%randval_5%%randval_6%%randval_7%%randval_8%%randval_9%%randval_10%%randval_11%%randval_12%%randval_13%%randval_14%%randval_15%%randval_16%
      if !outercount!==%QtySets% goto outerend
      :: repeat QtySets times
      goto outrloop
   :outerend
   :: now display the %byteCount% byte string
         REM echo if /i "%SepStat%"=="N"
         if /i "%SepStat%"=="N"  (set Result!maxcount!=%Rand1%%Rand2%%Rand3%%Rand4%%Rand5%%Rand6%%Rand7%%Rand8%%Rand9%%Rand10%%Rand11%%Rand12%%Rand13%%Rand14%%Rand15%%Rand16%) & goto :showit
         if /i "%SepStat%"=="N " (set Result!maxcount!=%Rand1%%Rand2%%Rand3%%Rand4%%Rand5%%Rand6%%Rand7%%Rand8%%Rand9%%Rand10%%Rand11%%Rand12%%Rand13%%Rand14%%Rand15%%Rand16%) & goto :showit
      if    "%SepChar%"=="" set "SS= "
      if /i "%SepChar%"=="S " (set "SS= "
      ) else (
      set "SS=-")
      REM for /l %%b in (16,-1,1) do (
         rem how to make this look better rem
         if defined rand16 set Result!maxcount!=%Rand1%%SS%%Rand2%%SS%%Rand3%%SS%%Rand4%%SS%%Rand5%%SS%%Rand6%%SS%%Rand7%%SS%%Rand8%%SS%%Rand9%%SS%%Rand10%%SS%%Rand11%%SS%%Rand12%%SS%%Rand13%%SS%%Rand14%%SS%%Rand15%%SS%%Rand16% & goto :showit
         if defined rand15 set Result!maxcount!=%Rand1%%SS%%Rand2%%SS%%Rand3%%SS%%Rand4%%SS%%Rand5%%SS%%Rand6%%SS%%Rand7%%SS%%Rand8%%SS%%Rand9%%SS%%Rand10%%SS%%Rand11%%SS%%Rand12%%SS%%Rand13%%SS%%Rand14%%SS%%Rand15% & goto :showit
         if defined rand14 set Result!maxcount!=%Rand1%%SS%%Rand2%%SS%%Rand3%%SS%%Rand4%%SS%%Rand5%%SS%%Rand6%%SS%%Rand7%%SS%%Rand8%%SS%%Rand9%%SS%%Rand10%%SS%%Rand11%%SS%%Rand12%%SS%%Rand13%%SS%%Rand14% & goto :showit
         if defined rand13 set Result!maxcount!=%Rand1%%SS%%Rand2%%SS%%Rand3%%SS%%Rand4%%SS%%Rand5%%SS%%Rand6%%SS%%Rand7%%SS%%Rand8%%SS%%Rand9%%SS%%Rand10%%SS%%Rand11%%SS%%Rand12%%SS%%Rand13% & goto :showit
         if defined rand12 set Result!maxcount!=%Rand1%%SS%%Rand2%%SS%%Rand3%%SS%%Rand4%%SS%%Rand5%%SS%%Rand6%%SS%%Rand7%%SS%%Rand8%%SS%%Rand9%%SS%%Rand10%%SS%%Rand11%%SS%%Rand12% & goto :showit
         if defined rand11 set Result!maxcount!=%Rand1%%SS%%Rand2%%SS%%Rand3%%SS%%Rand4%%SS%%Rand5%%SS%%Rand6%%SS%%Rand7%%SS%%Rand8%%SS%%Rand9%%SS%%Rand10%%SS%%Rand11% & goto :showit
         if defined rand10 set Result!maxcount!=%Rand1%%SS%%Rand2%%SS%%Rand3%%SS%%Rand4%%SS%%Rand5%%SS%%Rand6%%SS%%Rand7%%SS%%Rand8%%SS%%Rand9%%SS%%Rand10% & goto :showit
         if defined rand9  set Result!maxcount!=%Rand1%%SS%%Rand2%%SS%%Rand3%%SS%%Rand4%%SS%%Rand5%%SS%%Rand6%%SS%%Rand7%%SS%%Rand8%%SS%%Rand9% & goto :showit
         if defined rand8  set Result!maxcount!=%Rand1%%SS%%Rand2%%SS%%Rand3%%SS%%Rand4%%SS%%Rand5%%SS%%Rand6%%SS%%Rand7%%SS%%Rand8% & goto :showit
         if defined rand7  set Result!maxcount!=%Rand1%%SS%%Rand2%%SS%%Rand3%%SS%%Rand4%%SS%%Rand5%%SS%%Rand6%%SS%%Rand7% & goto :showit
         if defined rand6  set Result!maxcount!=%Rand1%%SS%%Rand2%%SS%%Rand3%%SS%%Rand4%%SS%%Rand5%%SS%%Rand6% & goto :showit
         if defined rand5  set Result!maxcount!=%Rand1%%SS%%Rand2%%SS%%Rand3%%SS%%Rand4%%SS%%Rand5% & goto :showit
         if defined rand4  set Result!maxcount!=%Rand1%%SS%%Rand2%%SS%%Rand3%%SS%%Rand4% & goto :showit
         if defined rand3  set Result!maxcount!=%Rand1%%SS%%Rand2%%SS%%Rand3% & goto :showit
         if defined rand2  set Result!maxcount!=%Rand1%%SS%%Rand2% & goto :showit
         if defined rand1  set Result!maxcount!=%Rand1% & goto :showit
      rem )
      
:showit   
REM pause > nul | echo Breakpoint2
   :: now suppress trailing spaces
   for /f "tokens=1-%byteCount% delims= " %%a in ("!Result%maxcount%!") do (
      if "!Result%maxcount%:~-1!"==" " set Result%maxcount%=!Result%maxcount%:  =!
      :: show on screen
      if %maxcount% LSS 10 (
         REM echo result1 is %result1%
         set Result!maxcount!=!Result%maxcount%! & echo  %%^Result!maxcount!%%^  = !Result%maxcount%!) else (
         set Result!maxcount!=!Result%maxcount%! & echo  %%^Result!maxcount!%%^ = !Result%maxcount%!)
   )
:: check if maxcount is equal to maxloop, if yes end, if not goto maxloop
if %maxcount% GEQ %MaxLoop% goto :end
goto maxloop

:end
echo.
REM if /i "%1"=="/r" endlocal & set QtySets=%QtySets% & set CharSet=%CharSet% & set outercount=0 & set maxcount=0 & set count=0 & set SepChar=%SepChar% & set SepStat=%SepStat% & set Maxloop=%Maxloop% & set ByteCount=%ByteCount% & goto :eof & echo Saving Presets...
   if /i "%1"=="/s" (
      for /l %%a in (16,-1,1) do (
         rem how to make this look better rem
         if defined result%%a if "%1"=="/s" endlocal & set Result1=%Result1% & set Result2=%Result2% & set Result3=%Result3% & set Result4=%Result4% & set Result5=%Result5% & set Result6=%Result6% & set Result7=%Result7% & set Result8=%Result8% & set Result9=%Result9% & set Result10=%Result10% & set Result11=%Result11% & set Result12=%Result12% & set Result13=%Result13% & set Result14=%Result14% & set Result15=%Result15% & set Result16=%Result16%
         if defined result%%a if "%1"=="/s" endlocal & set Result1=%Result1% & set Result2=%Result2% & set Result3=%Result3% & set Result4=%Result4% & set Result5=%Result5% & set Result6=%Result6% & set Result7=%Result7% & set Result8=%Result8% & set Result9=%Result9% & set Result10=%Result10% & set Result11=%Result11% & set Result12=%Result12% & set Result13=%Result13% & set Result14=%Result14% & set Result15=%Result15%
         if defined result%%a if "%1"=="/s" endlocal & set Result1=%Result1% & set Result2=%Result2% & set Result3=%Result3% & set Result4=%Result4% & set Result5=%Result5% & set Result6=%Result6% & set Result7=%Result7% & set Result8=%Result8% & set Result9=%Result9% & set Result10=%Result10% & set Result11=%Result11% & set Result12=%Result12% & set Result13=%Result13% & set Result14=%Result14%
         if defined result%%a if "%1"=="/s" endlocal & set Result1=%Result1% & set Result2=%Result2% & set Result3=%Result3% & set Result4=%Result4% & set Result5=%Result5% & set Result6=%Result6% & set Result7=%Result7% & set Result8=%Result8% & set Result9=%Result9% & set Result10=%Result10% & set Result11=%Result11% & set Result12=%Result12% & set Result13=%Result13%
         if defined result%%a if "%1"=="/s" endlocal & set Result1=%Result1% & set Result2=%Result2% & set Result3=%Result3% & set Result4=%Result4% & set Result5=%Result5% & set Result6=%Result6% & set Result7=%Result7% & set Result8=%Result8% & set Result9=%Result9% & set Result10=%Result10% & set Result11=%Result11% & set Result12=%Result12%
         if defined result%%a if "%1"=="/s" endlocal & set Result1=%Result1% & set Result2=%Result2% & set Result3=%Result3% & set Result4=%Result4% & set Result5=%Result5% & set Result6=%Result6% & set Result7=%Result7% & set Result8=%Result8% & set Result9=%Result9% & set Result10=%Result10% & set Result11=%Result11%
         if defined result%%a if "%1"=="/s" endlocal & set Result1=%Result1% & set Result2=%Result2% & set Result3=%Result3% & set Result4=%Result4% & set Result5=%Result5% & set Result6=%Result6% & set Result7=%Result7% & set Result8=%Result8% & set Result9=%Result9% & set Result10=%Result10%
         if defined result%%a if "%1"=="/s" endlocal & set Result1=%Result1% & set Result2=%Result2% & set Result3=%Result3% & set Result4=%Result4% & set Result5=%Result5% & set Result6=%Result6% & set Result7=%Result7% & set Result8=%Result8% & set Result9=%Result9%
         if defined result%%a if "%1"=="/s" endlocal & set Result1=%Result1% & set Result2=%Result2% & set Result3=%Result3% & set Result4=%Result4% & set Result5=%Result5% & set Result6=%Result6% & set Result7=%Result7% & set Result8=%Result8%
         if defined result%%a if "%1"=="/s" endlocal & set Result1=%Result1% & set Result2=%Result2% & set Result3=%Result3% & set Result4=%Result4% & set Result5=%Result5% & set Result6=%Result6% & set Result7=%Result7%
         if defined result%%a if "%1"=="/s" endlocal & set Result1=%Result1% & set Result2=%Result2% & set Result3=%Result3% & set Result4=%Result4% & set Result5=%Result5% & set Result6=%Result6%
         if defined result%%a if "%1"=="/s" endlocal & set Result1=%Result1% & set Result2=%Result2% & set Result3=%Result3% & set Result4=%Result4% & set Result5=%Result5%
         if defined result%%a if "%1"=="/s" endlocal & set Result1=%Result1% & set Result2=%Result2% & set Result3=%Result3% & set Result4=%Result4%
         if defined result%%a if "%1"=="/s" endlocal & set Result1=%Result1% & set Result2=%Result2% & set Result3=%Result3%
         if defined result%%a if "%1"=="/s" endlocal & set Result1=%Result1% & set Result2=%Result2%
         if defined result%%a if "%1"=="/s" endlocal & set Result1=%Result1%
      )
   )
if not "%1"=="/s" endlocal
:eof


Last edited by timbertuck on 06 Nov 2012 13:46, edited 2 times in total.



29 Oct 2012 17:46
Profile
Expert

Joined: 13 Jan 2012 21:24
Posts: 441
Post Re: Random Code Generator needs a little help
timbertuck wrote:
I created a RCG, nothing new there as they are a dime a dozen. But i need help on getting the Extended Character Set (as well as the Special) to generate properly. it breaks when using "E" or "S" for the character set, but all the others; A, AN, H, N work as designed.
you can run the program either by:
1) typing in Rand7
and use E or S for the CharSet
or
2) typing in Rand7 4 4 4 E N

Sorry, have no clue what your question even is. Perhaps you meant it as a private message to someone intimately familiar with your RCG? "Extended character set" and "special characters" ring some bells, but get lost in the mass of code. If you could shrink it down to a (few) line(s) that demonstrate the issue (and nothing but), that could help your cause and elicit better response.

Liviu


29 Oct 2012 22:08
Profile

Joined: 10 Feb 2012 02:20
Posts: 4309
Post Re: Random Code Generator needs a little help
Your code is running my batch files - this time below it ran N.BAT (nero is not installed) and earlier it ran J.BAT

Is it broken in some manner?

Code:
d:\folder> a.bat 4 4 4 E N

Generating a block size of 64 characters

 %Result1%  =  9 6       if 1==4 goto outerend3 ;D f Z X T 8 ?
The system cannot find the file c:\Program Files\Nero 8\Nero Burning Rom\nero.exe.


29 Oct 2012 22:14
Profile

Joined: 21 Dec 2011 14:21
Posts: 76
Post Re: Random Code Generator needs a little help
Hey foxidrive,

oh yes it is broken as you can see by the error message (there is nothing in my code about nero though).

first run:
RAND7 4 4 4 H N
and you will get:
%Result1% = 6AE5D0B3E035B8C4
%Result2% = FD28A75E0A6BE7D1
%Result3% = F2EF06DE06F9C52D
%Result4% = 99E22CE934976351

then run
RAND7 4 4 4 A N
and you will get:
%Result1% = lfFZhOeHBkhuRYmE
%Result2% = JgbhpVVgvtiMpfRL
%Result3% = CKJghUWHIlqnuMng
%Result4% = CwSluCsDwDiCUMuo

works for "H", "A", "AN","N" (as parameter #4)

but when you run either "E" or "S", you get broken results as so:
%Result1% = *j M if 1==4 goto outerendt }f F o ;z if 3==4 goto outerendf
%Result2% = $[n b 6 V if 2==4 goto outerendD s c if 3==4 goto outerend`f *}
%Result3% = .P M [n Z G D 3 u if 3==4 goto outerendB K o S
%Result4% = [t x ]:,D 5 ;h ~d [?

the Extended Set (as well as the Special Set) contain all of the keyboard "special" keys other than A-Z, a-z, 0-9, of which there are 33 (to include the SPACE character).

i know that using ^! or ^% cause problems (one is emitting a backspace) which is why they are in the reserved set, but all the other characters should emit properly
try by doing:
echo !s:~1,1!
echo !s:~3,1!
echo !s:~5,1!
.....
echo !s:~65,1!
you can see that it walks up the !S! character set from left to right using the above echo's. but one or more of them is causing the problem to break.

any insights?


30 Oct 2012 08:26
Profile

Joined: 21 Dec 2011 14:21
Posts: 76
Post Re: Random Code Generator needs a little help
Liviu wrote:
Sorry, have no clue what your question even is. Perhaps you meant it as a private message to someone intimately familiar with your RCG? "Extended character set" and "special characters" ring some bells, but get lost in the mass of code. If you could shrink it down to a (few) line(s) that demonstrate the issue (and nothing but), that could help your cause and elicit better response.
Liviu


The random code generator has 5 parameters, the fourth of which is the type of Character Set. All work except "E" and "S", both of which contain special characters. if you run the program without any parameters, it will revert to interrogatory mode and ask you for input. then it generates the code. the program works except when trying to use S or E.

i tried to condense it but without a good section of the code, it broke at that point. so if you could just run it, you will see that by using the defaults, it will generate a block of code. but change the charset from H to E and it breaks.

Rand7
# - Repeat Loop (1-64)
# - Qty Sets (1-16)
# - ByteCount (1-16)
X - CharSet (A-AN-E-H-N-S)
X - Delimiter Usage (Y-N)

so the question is how to use the E or S character set and have it generate without breaking


30 Oct 2012 08:36
Profile
Expert

Joined: 06 Dec 2011 22:15
Posts: 734
Location: México City, México
Post Re: Random Code Generator needs a little help
timbertuck wrote:
There are two other places that could look nicer :shock: , these are:
1) if defined rand16 set Result!maxcount!= found at the outerend loop
and
2) if defined result%%a if "%1"=="/s" endlocal & found at the end loop

Change first code segment by this one:
Code:
      for /L %%b in (16,-1,1) do (
         if defined rand%%b (
            rem Assemble the desired Result
            for %%r in (Result!maxcount!) do (
               rem %%r is the NAME of Result!maxcount!
               set Result!maxcount!=
               for /L %%i in (1,1,%%b) do (
                  set Result!maxcount!=!%%r!!Rand%%i!%SS%
               )
               rem Eliminate last %SS%
               set Result!maxcount!=!%%r:~0,-1!
            )
            goto :showit
         )
      )
You must agree that for /L %%b look nicer than for /l %%b, isn't it? :wink:

Antonio


30 Oct 2012 09:30
Profile

Joined: 21 Dec 2011 14:21
Posts: 76
Post Re: Random Code Generator needs a little help
Aacini wrote:
timbertuck wrote:
There are two other places that could look nicer :shock: , these are:

Change first code segment by this one:
Code:
      for /L %%b in (16,-1,1) do (
         if defined rand%%b (
            rem Assemble the desired Result
            for %%r in (Result!maxcount!) do (
               rem %%r is the NAME of Result!maxcount!
               set Result!maxcount!=
               for /L %%i in (1,1,%%b) do (
                  set Result!maxcount!=!%%r!!Rand%%i!%SS%
               )
               rem Eliminate last %SS%
               set Result!maxcount!=!%%r:~0,-1!
            )
            goto :showit
         )
      )
You must agree that for /L %%b look nicer than for /l %%b, isn't it? :wink:
Antonio


Wonderful! That works perfectly, thanks Antonio! one thing that i have not seen before is !%%r!, can you explain that? everything else i get...


30 Oct 2012 10:45
Profile

Joined: 21 Dec 2011 14:21
Posts: 76
Post Re: Random Code Generator needs a little help
Liviu wrote:
Sorry, have no clue what your question even is. Perhaps you meant it as a private message to someone intimately familiar with your RCG? "Extended character set" and "special characters" ring some bells, but get lost in the mass of code. If you could shrink it down to a (few) line(s) that demonstrate the issue (and nothing but), that could help your cause and elicit better response.
Liviu


so i tried to shrink it, but this works or appears to work as i can't get it to break like RAND7. notice it is not emitting the space correctly.

rand8.bas
Code:
@echo off
      echo           --01234567890123456789--"
setlocal enableextensions enabledelayedexpansion
      set  n=0123456789
      set  h=ABCDEF0123456789
      set  a=abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ
      set  an=abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789
      set "e=abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789~`@#$^&:;_/.,^*^-^+^=^\^|^]^[^{^}^'^?^(^)^<^>^^^""
      set "s=^~^`^@^#^$^^^&^:^;^_^/^.^,^*^-^+^=^\^|^]^[^{^}^'^?^(^)^<^>^ ^^^""
      SET "RESERVED1=^ "
      SET "RESERVED2=^!"
      SET "RESERVED3=%%"
      set count3=0
      :maxloop
      set /a count3+=1
      if %count3% GTR 20 goto :eof
      set p=2
      set count=0
      set count2=0
      :outrloop
      set /a count2+=1
      if %count2% GTR 10 goto end
      :innrloop
      set /a count+=1
      set outerx=
      if %count% GTR 20 goto dothis
      set /a eval5=%random% %% 66
      set /a eval1=%eval5% %% 2
      if %eval1%==0 set /a eval5+=1
      set outerx=!s:~%eval5%,1!
      set innerx=!innerx!!outerx!
      goto innrloop
      :dothis
      goto outrloop
      :end
      echo innerx is --!innerx!--
      set innerx=
      goto maxloop
endlocal


30 Oct 2012 10:47
Profile
Expert

Joined: 06 Dec 2011 22:15
Posts: 734
Location: México City, México
Post Re: Random Code Generator needs a little help
timbertuck wrote:
one thing that i have not seen before is !%%r!, can you explain that?
In your code you have the Result!maxcount! variable that must accumulate the value of several Rand... variables. The usual way to do that is initializing Result!maxcount! to an empty string and then accumulate the desired variables in a FOR loop:
Code:
set Result!maxcount!=
for /L %%i in (1,1,%%b) do (
   set Result!maxcount!=!Result!maxcount!!!Rand%%i!%SS%
   rem new_value       =previous_value    etc...
)
However, this would require a double delayed expansion: first on !maxcount! and then on !Result!maxcount!!. The for %%r in (Result!maxcount!) command achieve the first expansion and put Result!maxcount! in %%r, so a further !%%r! achieve the required double expansion. 8)

You may even use this trick to do a three level delayed expansion (or more) in the same line with several nested for commands :wink:

Antonio


30 Oct 2012 11:34
Profile

Joined: 21 Dec 2011 14:21
Posts: 76
Post Re: Random Code Generator needs a little help
Aacini wrote:
You may even use this trick to do a three level delayed expansion (or more) in the same line with several nested for commands :wink:
Antonio


Way Cool Antonio, :P

now to find a way to do just that (three level), so let me search for something to fill in the blanks. i will be asking about this again.

just love this place..you guys are uber-guru's! :roll:


now on the OP, how can i get the (E)xtended or (S)pecial character set to work? All my work is for naught if i can't find out why its not working right???

And then there is the other kludge at the :end loop. how can i condense that?
if defined result%%a if "%1"=="/s" endlocal & set


30 Oct 2012 13:21
Profile
Expert

Joined: 06 Dec 2011 22:15
Posts: 734
Location: México City, México
Post Re: Random Code Generator needs a little help
timbertuck wrote:
And then there is the other kludge at the :end loop. how can i condense that?
if defined result%%a if "%1"=="/s" endlocal & set
The problem with this part is that the endlocal must be executed in the same line that all sets, but I think it can be solved this way:
Code:
      for /L %%a in (16,-1,1) do (
         if defined result%%a if "%1"=="/s" (
            set preserve=endlocal
            for /L %%i in (1,1,%%a) do (
               set preserve=!preserve! ^& set Result%%i=%%Result%%i%%
            )
            call !preserve!
         )
      )


Antonio


30 Oct 2012 15:51
Profile

Joined: 21 Dec 2011 14:21
Posts: 76
Post Re: Random Code Generator needs a little help
Aacini wrote:
timbertuck wrote:
And then there is the other kludge at the :end loop. how can i condense that?
if defined result%%a if "%1"=="/s" endlocal & set
The problem with this part is that the endlocal must be executed in the same line that all sets, but I think it can be solved this way:
Code:
      for /L %%a in (16,-1,1) do (
         if defined result%%a if "%1"=="/s" (
            set preserve=endlocal
            for /L %%i in (1,1,%%a) do (
               set preserve=!preserve! ^& set Result%%i=%%Result%%i%%
            )
            call !preserve!
         )
      )
Antonio


hmmm i think i need some sleep cause its not working. i mean i can run RAND7 /S and it generates the code but does not save it to the RESULT vars.

i think i see what your doing but again i need to recharge so i will look at this in the morning. Thanks again Antonio for helping out.

TT

EDIT: you can call an expanded var?? hmmm another new thing for me to look at...

EDIT: so i dumbed down :shock: what you did to this (just the first instance), let me know if its correct??

Code:
if defined result1 if "%1"=="/s" set preserve=endlocal ^& set Result1=%%Result1%%
call !preserve!


so its not working though, im on my first cup of joe and the brain is a tickin :P

what i find fascinating is the call line. i hadnt seen this before (or if i did, i glossed over it) and that is way cool. so i did this little test to see if i understood the components.

Code:
set %result1%=hello
set preserve=echo.helloWorld ^& set result1=%%Result1%%
call %preserve%


and wallah, output was helloWorld

this use of a unexpanded var with the call command is like calling a macro, eh? so i checked by doing a CALL /? and no where is there a hint that you can call a variable this way. So can you point me in the right direction or maybe explain a little further.

so neat though and you can do input in the macro, like this:
Code:
set preserve=echo.hello ^& set result1=%%Result1%% ^& set /pVar="Input Y/N? "

what else can you do with this structure (meaning neat stuff)??

Thanks for your help


30 Oct 2012 20:59
Profile

Joined: 21 Dec 2011 14:21
Posts: 76
Post Re: Random Code Generator needs a little help
Aacini wrote:
Antonio


Hey Antonio, can you look at that last bit of code to see why its not executing right?

thanks


31 Oct 2012 20:08
Profile

Joined: 21 Dec 2011 14:21
Posts: 76
Post Re: RCG needs help with possible poison characters
So i have gotten this so far, it doesnt break when running the Extended or Special Set, however it doesnt emit properly (in that it does not generate a full byteCount on the result line and has lots of spaces which is in the reserved envars) so can someone add some further input on why this isn't displaying correctly? I know im close but still need a nudge in the right direction.

the other section at the end (if %1==/s) that antonio was trying to help out doesnt save the environment variables either, would like to know why.

thanks for all of your help.

note on the E and S charset, as you can see im echoing the entire %S% set, then each odd char in %S%, then each odd on the same line, then the reserved characters. none of them break, they all emit properly, so im confused as to why the code isnt working for E and S.


to run, just run RANDOM7, choose S or E for CharSet, 64 for Loop Count and default all the rest.

RANDOM7.bas
Code:
@echo off
break=on
echo.

set QtySets=&set CharSet=&set SepStat=&set SepChar=&set ByteCount=&set MaxLoop=
set result1=&set result2=&set result3=&set result4=&set result5=&set result6=
set result7=&set result8=&set result9=&set result10=&set result11=&set result12=
set result13=&set result14=&set result15=&set result16=
set maxcount=0&set count=0

setlocal EnableExtensions EnableDelayedExpansion

if "%1"=="" goto :askque4

if /i "%1"=="/h" goto :help
if    "%1"=="/?" goto :help
if /i "%1"=="/s" goto :askque4

:: Maxloop QtySets ByteCount CharSet SepStat but not SepChar
   if "%1" GTR 0 if "%2" GTR if "%3" GTR 0 if not "%4"=="" if not "%5"=="" (
         set MaxLoop=%1
         set QtySets=%2
         set ByteCount=%3
         set CharSet=%4
         set SepStat=%5
         goto :initset
   )
      
goto :askque4

:help
echo %0 will create a block of random code based on your input.
echo.
echo The program will ask for character set, loop count, byte size and repeat byte.
echo.
echo The max for loop count  is 64
echo The max for byte size   is 16
echo The max for repeat byte is 16
echo.
echo Thus the max block size is 16K, you will need to extend the DOS console
echo session so that the screen buffer width is 250 or greater, so that will
echo fit the entire block on a page. You will need to be able to scroll to
echo capture the entire block. Remember to press Enter to complete the copy.
echo.
echo The character set can be one of the following:   Unique Key's
echo ________   ___________________________________ ____________
echo.
echo Alpha    - Upper and Lower Case A-Z, a-z   ^(52^)
echo Extended - Alpha + Number + Special Characters   ^(93^)
echo Hex    - Hexadecimal A-Z,0-9         ^(16^)
echo Number    - Numbers 0-9            ^(10^)
echo AlphaNum - AlphaNumeric A-Z, a-z, 0-9      ^(62^)
echo.
echo This program will produce ^("to the best of its known abilites"^) completely
echo random code.
echo.
echo The default charcter set is Hex, Loop Count, Byte Size and Repeat Byte is 4. 
echo This is a 64 byte block of random code to use as you deem fit.
echo Max possibilites 16 ^^ 64 = 1.157920892373162e+077.
echo.
pause > nul | echo Press any key to see More
echo.
echo Tip: You can use the Edit-^>Mark command of the console to mark a block of text,
echo hit enter to save selected text. Then you can paste into another document or
echo program.
echo.
echo Tip: Set the properties of the CMD.EXE to Quick Edit mode. Then mark text with
echo Left click and Drag, Right click to copy selected text. Paste to document or
echo program.
echo.
echo Tip: To save the result(s) to the environment table, use the /s switch. Type
echo "SET result" to view the ouptut of %0. Note: Running a subsuquent %0
echo without the /s switch will clear the previous output to the environment table.
echo.
echo Tip: Place all parameters on the command line, %0 # # # X Y. As an example
echo try %0 4 4 4 A N, will generate a 64 byte code block using the Alpha
echo CharSet and will not use a byte seperator.
echo.
echo The Author ^(and other Distributers^) of this software will not be held 
echo responsible for any damages caused by said software. The is no warranty,
echo implied or otherwise. Tbis is to be used for your education of Random Code
echo Generator's.
goto :eof

:askque4
:: find out which character set to use
echo CharSet(Possibilities)   Expanded
echo ======================   ====================================
echo Alpha^(52^)       A-Z, a-z
echo AlphaNumeric^(62^)    A-Z, a-z, 0-9
echo Extended^(93^)      A-Z, a-z, 0-9, All exc "^!","%%"
echo Hex^(16^)         A-F, 0-9
echo Numbers^(10^)      0-9
echo Special^(33^)      All exc "^!","%%"
echo.
set /p CharSet=Choose Character Set [A^/AN^/E^/H^/N^/S] ^<H^>
echo.
if "%CharSet%"=="" set CharSet=H
if /i not "%CharSet%"=="A" if /i not "%CharSet%"=="E" if /i not "%CharSet%"=="H" if /i not "%CharSet%"=="N" if /i not "%CharSet%"=="AN" if /i not "%CharSet%"=="S" goto :askque4

:askque3
:: how many time to repeat random request
set /p MaxLoop=How many times to repeat selection? [1-64] ^<4^>
echo.
if "%MaxLoop%"=="" set MaxLoop=4
if %MaxLoop% GTR 0 if %MaxLoop% LSS 65 goto askque2
echo.
echo %MaxLoop% not in the expected range [1-16]
echo.
goto askque3

:askque2
:: get the amount of characters to display per string
set /p byteCount=How many digits do you want to display per pair? [1-16] ^<4^>
echo.
if "%byteCount%"=="" set byteCount=4
if %byteCount% GTR 0 if %byteCount% LSS 17 goto askque1
echo.
echo %byteCount% not in the expected range [1-16]
echo.
goto askque2

:askque1
:: get the amount of %byteCount% byte pairs to be generated and displayed
set /p QtySets=How many sets of %byteCount% do you want to generate? [1-16] ^<4^>
echo.
if "%QtySets%"=="" set QtySets=4
if %QtySets%  GTR 0 if %QtySets% LSS 17 goto :askque5
echo %QtySets% not in the expected range [1-16]
echo.
goto askque1

:askque5
:: ask about seperator usage
set /p SepStat=Use a seperator between sets? [Y-N] ^<N^>
echo.
if    "%SepStat%"==""  set SepStat=N & goto :initset
if /i "%SepStat%"=="Y" set SepStat=Y & goto :askque6
if /i "%SepStat%"=="N" set SepStat=N & goto :initset
goto :askque5

:: ask about type of seperator
:askque6
set /p SepChar=Use a Dash or Space as delimiter? [D-S] ^<S^>
echo.
if    "%SepChar%"==""  set SepChar=S & goto :initset
if /i "%SepChar%"=="S" set SepChar=S & goto :initset
if /i "%SepChar%"=="D" set SepChar=D & goto :initset
goto :askque6

:: loop to create string value; character setLoop Count, ByteCount RepeatByte
:: eg.  519B or 6C2B0A or 0F14A28CD or AlFGHJdKaceD, etc...
:initset
REM if /i "%1"=="/repeat" echo \%QtySets%\ /%SepStat%/ \%ByteCount%\ /%Maxloop%/ \%CharSet%\
REM echo \!CharSet!\ /!Maxloop!/ \!ByteCount!\ /!QtySets!/ \!SepStat!\
   :: make the SPECIAL characters
   :: note: some ommited, see end of list - "RESERVED"
   :: make the A-Z characters
   :: make the a-z characters
   :: make the 0-9 characters
   set n=0123456789
   set h=ABCDEF0123456789
   set a=abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ
   set an=abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789
   set "e=abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789~`@#$&:;_/.,*-+=\|][{}'?()<>@*"
   set "s=^~^`^#^$^&^:^;^_^/^.^,^-^+^=^\^|^]^[^{^}^'^?^(^)^@^*^<^>^""
   rem SPACE appears to work but not yet tested fully, appears in CharSet after the ^>
   SET "RESERVED1= "
   rem the two reserved characters do not work, how to get them to work?
   SET "RESERVED2=^!""
   SET "RESERVED3=%%"
   echo !s!
   echo !s:~1,1!
   echo !s:~3,1!
   echo !s:~5,1!
   echo !s:~7,1!
   echo !s:~9,1!
   echo !s:~11,1!
   echo !s:~13,1!
   echo !s:~15,1!
   echo !s:~17,1!
   echo !s:~19,1!
   echo !s:~21,1!
   echo !s:~23,1!
   echo !s:~25,1!
   echo !s:~27,1!
   echo !s:~29,1!
   echo !s:~31,1!
   echo !s:~33,1!
   echo !s:~35,1!
   echo !s:~37,1!
   echo !s:~39,1!
   echo !s:~41,1!
   echo !s:~43,1!
   echo !s:~45,1!
   echo !s:~47,1!
   echo !s:~49,1!
   echo !s:~51,1!
   echo !s:~53,1!
   echo !s:~55,1!
   echo !s:~57,1!
   REM echo !s:~59,1!
   REM echo !s:~61,1!

   echo --^>!s:~1,1!!s:~3,1!!s:~5,1!!s:~7,1!!s:~9,1!!s:~11,1!!s:~13,1!!s:~15,1!!s:~17,1!!s:~19,1!!s:~21,1!!s:~23,1!!s:~25,1!!s:~27,1!!s:~29,1!!s:~31,1!!s:~33,1!!s:~35,1!!s:~37,1!!s:~39,1!!s:~41,1!!s:~43,1!!s:~45,1!!s:~47,1!!s:~49,1!!s:~51,1!!s:~53,1!!s:~55,1!!s:~57,1!!s:~59,1!!s:~61,1!^<--
   echo --^>!reserved1!!reserved2!!reserved3!^<--
   :: unrem to see the extended set
   REM echo %e%
   :: unrem to see the special set
   REM echo %s%
   :: set random to eval
   REM set /a eval1=%random% %% 10
   REM set /a eval2=%random% %% 16
   REM set /a eval3=%random% %% 52
   REM set /a eval4=%random% %% 62
   REM set /a eval5=%random% %% 96
   REM set /a eval7=%random% %% 34
   set /a eval6=%Maxloop% * %byteCount% * %QtySets%
if %Maxloop% GTR 1 (echo Generating a block size of %eval6% characters) else (
   echo Generating a string size of %eval6% characters)
   echo.
:maxloop
REM echo off
REM pause > nul | echo Breakpoint1
set /a maxcount=%maxcount% + 1
   :continue
   set outercount=0
      :outrloop
      set /a outercount=!outercount! + 1
      set count=0
         :innrloop
         set /a count=count + 1
         :: get return of random mod based on CharSet
         :: Has NOT Passed Range Testing
         :: set the character set
         :askque7
         :: goto CharSet and get random character
         if /i "%CharSet%"=="A"  set /a eval3=%random% %% 52 & set randval=!a:~%eval3%,1!  & goto :charstsk
         if /i "%CharSet%"=="E"  (
            set /a eval5=%random% %% 91
            if !eval5! LEQ 62 set randval=!an:~%eval5%,1!  & goto :charstsk
            if !eval5! GTR 62 set /a eval5=!eval5! * 2 - 125
            set randval=!s:~%eval5%,1!
         ) & goto :charstsk
         if /i "%CharSet%"=="H"  set /a eval2=%random% %% 16 & set randval=!h:~%eval2%,1!  & goto :charstsk
         if /i "%CharSet%"=="N"  set /a eval1=%random% %% 10 & set randval=!n:~%eval1%,1!  & goto :charstsk
         if /i "%CharSet%"=="AN" set /a eval4=%random% %% 62 & set randval=!an:~%eval4%,1!  & goto :charstsk
         if /i "%CharSet%"=="S"  set /a eval7=%random% %% 29 & set randval=!s:~%eval7%,1!  & goto :charstsk
         goto askque7
         :charstsk
         :: sets the nth character of randval
         REM echo !randval!
         REM pause
         set "randval_!count!=!randval:"=!"
         if !count!==%byteCount% goto innrend
         goto innrloop
      :innrend
      set "Rand!outercount!=%randval_1%%randval_2%%randval_3%%randval_4%%randval_5%%randval_6%%randval_7%%randval_8%%randval_9%%randval_10%%randval_11%%randval_12%%randval_13%%randval_14%%randval_15%%randval_16%
      if !outercount!==%QtySets% goto outerend
      :: repeat QtySets times
      goto outrloop
   :outerend
   :: now display the %byteCount% byte string
         REM echo if /i "%SepStat%"=="N"
         REM echo "!sepstat!" and !sepstat:~0,1!
         if /i "%SepStat:~0,1%"=="N"  (set "Result!maxcount!=%Rand1%%Rand2%%Rand3%%Rand4%%Rand5%%Rand6%%Rand7%%Rand8%%Rand9%%Rand10%%Rand11%%Rand12%%Rand13%%Rand14%%Rand15%%Rand16%") & goto :showit
         REM if /i "%SepStat%"=="N " (set Result!maxcount!=%Rand1%%Rand2%%Rand3%%Rand4%%Rand5%%Rand6%%Rand7%%Rand8%%Rand9%%Rand10%%Rand11%%Rand12%%Rand13%%Rand14%%Rand15%%Rand16%) & goto :showit
      if    "%SepChar%"=="" set "SS= "
      if /i "%SepChar%"=="S " (set "SS= "
      ) else (
      set "SS=-")
        for /L %%b in (16,-1,1) do (
          if defined rand%%b (
            for %%r in (Result!maxcount!) do (
               set "Result!maxcount!="
               for /L %%i in (1,1,%%b) do (
                  set "Result!maxcount!=!%%r!!Rand%%i!%SS%")
                  set "Result!maxcount!=!%%r:~0,-1!")
                  goto :showit
               )
            )
         )
      
:showit   
   REM pause > nul | echo Breakpoint2
   :: now suppress trailing spaces
   for /f "tokens=1-%byteCount% delims= " %%a in ("!Result%maxcount%!") do (
      if "!Result%maxcount%:~-1!"==" " set Result%maxcount%=!Result%maxcount%:  =!
      :: show on screen
      if %maxcount% LSS 10 (
         REM echo result1 is %result1%
         set Result!maxcount!=!Result%maxcount%! & echo  %%^Result!maxcount!%%^  = !Result%maxcount%!) else (
         set Result!maxcount!=!Result%maxcount%! & echo  %%^Result!maxcount!%%^ = !Result%maxcount%!)
   )
:: check if maxcount is equal to maxloop, if yes end, if not goto maxloop
if %maxcount% GEQ %MaxLoop% goto :end
goto maxloop

:end
echo.
REM if /i "%1"=="/r" endlocal & set QtySets=%QtySets% & set CharSet=%CharSet% & set outercount=0 & set maxcount=0 & set count=0 & set SepChar=%SepChar% & set SepStat=%SepStat% & set Maxloop=%Maxloop% & set ByteCount=%ByteCount% & goto :eof & echo Saving Presets...
      if /i "%1"=="/s" (
         REM for /l %%a in (16,-1,1) do (
            REM set result
            REM echo %%a
            :: this doessnt save the RESULT environment variable, why???
         set newvar=!result%%a!
         for /L %%a in (16,-1,1) do (
            if defined result%%a (
               set preserve=endlocal
               for /L %%i in (1,1,%%a) do (
                  set "preserve=!preserve! ^& set Result%%i=^%^%Result%%i^%^%"
               )
               call !preserve!
            )
         )
          REM echo if defined result%%a if "%1"=="/s" (set preserve=endlocal ^& set Result%%a=%newvar% & echo calling preserve
            REM if defined result%%a if "%1"=="/s" (set preserve=endlocal ^& set Result%%a=%newvar% & echo calling preserve
             REM if defined result3 if "%1"=="/s" (set preserve=endlocal ^& set Result4=%%Result3%% & echo calling preserve)
             REM if defined result2 if "%1"=="/s" (set preserve=endlocal ^& set Result4=%%Result2%% & echo calling preserve)
             REM if defined result1 if "%1"=="/s" (set preserve=endlocal ^& set Result4=%%Result1%% & echo calling preserve)
             REM call %preserve%
            REM )
         rem how to make this look better rem
            REM if defined result%%a if "%1"=="/s" endlocal & set Result1=%Result1% & set Result2=%Result2% & set Result3=%Result3% & set Result4=%Result4% & set Result5=%Result5% & set Result6=%Result6% & set Result7=%Result7% & set Result8=%Result8% & set Result9=%Result9% & set Result10=%Result10% & set Result11=%Result11% & set Result12=%Result12% & set Result13=%Result13% & set Result14=%Result14% & set Result15=%Result15% & set Result16=%Result16%
            REM if defined result%%a if "%1"=="/s" endlocal & set Result1=%Result1% & set Result2=%Result2% & set Result3=%Result3% & set Result4=%Result4% & set Result5=%Result5% & set Result6=%Result6% & set Result7=%Result7% & set Result8=%Result8% & set Result9=%Result9% & set Result10=%Result10% & set Result11=%Result11% & set Result12=%Result12% & set Result13=%Result13% & set Result14=%Result14% & set Result15=%Result15%
            REM if defined result%%a if "%1"=="/s" endlocal & set Result1=%Result1% & set Result2=%Result2% & set Result3=%Result3% & set Result4=%Result4% & set Result5=%Result5% & set Result6=%Result6% & set Result7=%Result7% & set Result8=%Result8% & set Result9=%Result9% & set Result10=%Result10% & set Result11=%Result11% & set Result12=%Result12% & set Result13=%Result13% & set Result14=%Result14%
            REM if defined result%%a if "%1"=="/s" endlocal & set Result1=%Result1% & set Result2=%Result2% & set Result3=%Result3% & set Result4=%Result4% & set Result5=%Result5% & set Result6=%Result6% & set Result7=%Result7% & set Result8=%Result8% & set Result9=%Result9% & set Result10=%Result10% & set Result11=%Result11% & set Result12=%Result12% & set Result13=%Result13%
            REM if defined result%%a if "%1"=="/s" endlocal & set Result1=%Result1% & set Result2=%Result2% & set Result3=%Result3% & set Result4=%Result4% & set Result5=%Result5% & set Result6=%Result6% & set Result7=%Result7% & set Result8=%Result8% & set Result9=%Result9% & set Result10=%Result10% & set Result11=%Result11% & set Result12=%Result12%
            REM if defined result%%a if "%1"=="/s" endlocal & set Result1=%Result1% & set Result2=%Result2% & set Result3=%Result3% & set Result4=%Result4% & set Result5=%Result5% & set Result6=%Result6% & set Result7=%Result7% & set Result8=%Result8% & set Result9=%Result9% & set Result10=%Result10% & set Result11=%Result11%
            REM if defined result%%a if "%1"=="/s" endlocal & set Result1=%Result1% & set Result2=%Result2% & set Result3=%Result3% & set Result4=%Result4% & set Result5=%Result5% & set Result6=%Result6% & set Result7=%Result7% & set Result8=%Result8% & set Result9=%Result9% & set Result10=%Result10%
            REM if defined result%%a if "%1"=="/s" endlocal & set Result1=%Result1% & set Result2=%Result2% & set Result3=%Result3% & set Result4=%Result4% & set Result5=%Result5% & set Result6=%Result6% & set Result7=%Result7% & set Result8=%Result8% & set Result9=%Result9%
            REM if defined result%%a if "%1"=="/s" endlocal & set Result1=%Result1% & set Result2=%Result2% & set Result3=%Result3% & set Result4=%Result4% & set Result5=%Result5% & set Result6=%Result6% & set Result7=%Result7% & set Result8=%Result8%
            REM if defined result%%a if "%1"=="/s" endlocal & set Result1=%Result1% & set Result2=%Result2% & set Result3=%Result3% & set Result4=%Result4% & set Result5=%Result5% & set Result6=%Result6% & set Result7=%Result7%
            REM if defined result%%a if "%1"=="/s" endlocal & set Result1=%Result1% & set Result2=%Result2% & set Result3=%Result3% & set Result4=%Result4% & set Result5=%Result5% & set Result6=%Result6%
            REM if defined result%%a if "%1"=="/s" endlocal & set Result1=%Result1% & set Result2=%Result2% & set Result3=%Result3% & set Result4=%Result4% & set Result5=%Result5%
            REM if defined result%%a if "%1"=="/s" endlocal & set Result1=%Result1% & set Result2=%Result2% & set Result3=%Result3% & set Result4=%Result4%
            REM if defined result%%a if "%1"=="/s" endlocal & set Result1=%Result1% & set Result2=%Result2% & set Result3=%Result3%
            REM if defined result%%a if "%1"=="/s" endlocal & set Result1=%Result1% & set Result2=%Result2%
            REM if defined result%%a if "%1"=="/s" endlocal & set Result1=%Result1%
   
if not "%1"=="/s" endlocal
:eof



06 Nov 2012 11:27
Profile

Joined: 21 Dec 2011 14:21
Posts: 76
Post Re: RCG needs help with possible poison characters (getting
would appreciate it someone could set me on the right track. anyone???


09 Nov 2012 14:05
Profile
Display posts from previous:  Sort by  
Post new topic Reply to topic  [ 47 posts ]  Go to page 1, 2, 3, 4  Next


Who is online

Users browsing this forum: Yahoo [Bot] and 19 guests


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum

Search for:
Jump to:  
Powered by phpBB © 2000, 2002, 2005, 2007 phpBB Group.
Forum style by Vjacheslav Trushkin for Free Forums/DivisionCore.