home *** CD-ROM | disk | FTP | other *** search
/ Shareware Supreme Volume 6 #1 / swsii.zip / swsii / 199 / 4LOGIC10.ZIP / 4LVCPROC.BTM < prev    next >
Encoding:
Text File  |  1992-06-25  |  7.5 KB  |  241 lines

  1. :*******************************************************************************
  2. : A 4LOGIC bathc utility      A Free program. All of the code here is released
  3. :                             to the public domain.
  4. : Name: 4LVCPROC.btm  v.1.0
  5. :
  6. : Author: Brad Owen
  7. :
  8. : Description: 4LVC module to pre-process input prior to calling another module
  9. :
  10. :              ** This program cannot be run standalone **
  11. :              **     It can only be called by 4LVC     **
  12. :
  13. :*******************************************************************************
  14. @echo off
  15.  
  16.     iff %_batch == 1 then
  17.         cls
  18.         beep 400 2 350 2 400 2 350 2 400 2 350 2
  19.         echo.
  20.         echo 4LVCPROC error: This program cannot be run standalone.
  21.         quit
  22.     endiff
  23.  
  24.     set LVCRESP=
  25.     set LVCFMT=
  26.     set LVCOK=
  27.     cls
  28.  
  29.     @md %_cwd\4lvc-wrk >&! NUL
  30.     @del /qy %_cwd\4Lvc-wrk\*.* >&! NUL
  31.  
  32. :TESTPARMS
  33.  
  34.     if "%1"=="" goto WRAPUP
  35.     set PWORD=
  36.     set ARCHPASS=
  37.     set NOPASS=
  38.  
  39.     iff "%1"=="4lvc-*.zip" then
  40.         set pword=
  41.         set nopass=%1
  42.         set LVCFMT=EXT
  43.         goto PROCESSING
  44.     endiff
  45.  
  46.     iff exist 4lvcp%1.zip .OR. exist 4lvc-%1.zip then
  47.         iff exist 4lvcp%1.zip then
  48.             set pword=
  49.             set archpass=4lvcp%1.zip
  50.         endiff
  51.  
  52.         iff exist 4lvc-%1.zip then
  53.             set nopass=4lvc-%1.zip
  54.         endiff
  55.  
  56.         set LVCFMT=EXT
  57.         goto PROCESSING
  58.     endiff
  59.  
  60.     iff exist 4lvcp%@ext[%1].zip .OR. exist 4lvc-%@ext[%1].zip then
  61.         iff exist 4lvcp%@ext[%1].zip then
  62.             set pword=
  63.             set archpass=4lvcp%@ext[%1].zip
  64.         endiff
  65.         iff exist 4lvc-%@ext[%1].zip then
  66.             set nopass=4lvc-%@ext[%1].zip
  67.         endiff
  68.         set LVCFMT=FIL
  69.  
  70.         goto PROCESSING
  71.     endiff
  72.  
  73.     shift
  74.     goto TESTPARMS
  75. :*******************************************************************************
  76. : Routine to get password
  77.  
  78. :GET_PASS
  79.         cls
  80.         drawbox 0  0  10 79 0 whi on cya fill blu
  81.         scrput  2 32     gre on blu %ARCHPASS
  82.         scrput  3 25 bri yel on blu is a password protected file.
  83.         scrput  4 21 bri yel on blu You must enter the correct password
  84.         scrput  5 18 bri yel on blu in order to process files in this archive.
  85.         scrput  8 32 bri yel on blu [          ]
  86.         screen  8 33
  87.         input %%pword
  88.             iff "%pword" == "" then
  89.                 cls
  90.                 beep 400 2 350 2 400 2 350 2 400 2 350 2
  91.                 echo 4LVC error: You MUST enter a password to
  92.                 echo process files in this archive.
  93.                 pause
  94.                 goto GET_PASS
  95.             endiff
  96.  
  97.         pkunzip -t -s%pword %ARCHPASS > passtest.0
  98.  
  99.         set ptest=%@line[passtest.0,%@lines[passtest.0]]
  100.             iff "%ptest"== "PKUNZIP: No file(s) found." then
  101.                 cls
  102.                 beep 400 2 350 2 400 2 350 2 400 2 350 2
  103.                 echo 4LVCPROC error: The password you entered:    %pword
  104.                 echo                 is incorrect
  105.                 pause Press a key to return to Main Menu...
  106.                 del /q 4LVC.0 >& NUL
  107.                 del /q 4LVC.1 >& NUL
  108.                 del /q /y %_cwd\4lvc-wrk\*.* >& NUL
  109.                 rd %_cwd\4lvc-wrk >& NUL
  110.                 del /q passtest.0
  111.                 set LVCRESP=
  112.                 set LVCVER=
  113.                 set LVCNAM=
  114.                 set ARCHDESC=
  115.                 set LVCRC=
  116.                 set pword=
  117.                 set ptest=
  118.                 quit
  119.             endiff
  120.         del /q passtest.0
  121.         return
  122.  
  123. : End of password routine
  124. :*******************************************************************************
  125.  
  126. :*******************************************************************************
  127. : Begin processing routines
  128.  
  129. :PROCESSING
  130.  
  131.  
  132.  
  133.     iff "%LVCFMT" EQ "FIL" then
  134.         if "%archpass" NE "" for %%Z in (%archpass) do gosub LOOP
  135.         if "%nopass" NE "" for %%Z in (%nopass) do gosub LOOP
  136.     endiff
  137.  
  138.  
  139.  
  140.     iff "%LVCFMT" EQ "EXT" then
  141.         if "%archpass" NE "" for %%Z in (%archpass) do gosub LOOP
  142.         if "%nopass" NE "" for %%Z in (%nopass) do gosub LOOP
  143.     endiff
  144.  
  145.  
  146.     shift
  147.     set LVCFMT=
  148.     goto TESTPARMS
  149.  
  150. :WRAPUP
  151.     iff "%LVCOK" EQ "" then
  152.         cls
  153.         beep 400 2 350 2 400 2 350 2 400 2 350 2
  154.         echo 4LVCPROC: No archive files found with extensions provided.
  155.         pause Press a key to continue...
  156.     endiff
  157.     set LVCOK=
  158.     @del /qy %_cwd\4Lvc-wrk\*.* >&! NUL
  159.     rd %_cwd\4Lvc-wrk >&! NUL
  160.     cls
  161.     quit
  162.  
  163. :LOOP
  164.     cls
  165.     set LVCOK=X
  166.     echos Processing archive file %@upper[%Z]. Please wait a moment...
  167.     iff "%LVCFMT" EQ "FIL" then
  168.         iff "%archpass" NE "" then
  169.             gosub GET_PASS
  170.         endiff
  171.         PKZIP -q-vcbrd %Z %@name[%1].* >&! %_cwd\4Lvc-wrk\4LVCXTRC.0
  172.     else
  173.         iff "%archpass" NE "" then
  174.             gosub GET_PASS
  175.         endiff
  176.         PKZIP -q-vcbrd %Z >&! %_cwd\4Lvc-wrk\4LVCXTRC.0
  177.     endiff
  178.  
  179.     set LVCRCD=8
  180.     set LVCEND=%@lines[%_cwd\4LVC-wrk\4LVCXTRC.0]
  181.     gosub LOOPTOP
  182.     return
  183.  
  184. :LOOPTOP
  185.     if %LVCRCD GT %LVCEND goto LOOPEND
  186.     if "%@substr[%@line[%_cwd\4Lvc-wrk\4LVCXTRC.0,%LVCRCD],1,6]" EQ "------" goto LOOPIN
  187.  
  188. :LOOPOUT
  189.     set LVCRCD=%@eval[%LVCRCD + 1]
  190.     goto LOOPTOP
  191.  
  192. :LOOPIN
  193.     set LVCRCD=%@eval[%LVCRCD + 1]
  194.     if "%@substr[%@line[%_cwd\4Lvc-wrk\4LVCXTRC.0,%LVCRCD],1,6]" EQ "------" goto LOOPOUT
  195.     set LVCNAM=%@substr[%@line[%_cwd\4Lvc-wrk\4LVCXTRC.0,%LVCRCD],46,12]
  196.     set LVCRCD=%@eval[%LVCRCD + 1]
  197.     set LVCCOM=%@substr["%@line[%_cwd\4Lvc-wrk\4LVCXTRC.0,%LVCRCD]                                                   ",10,41]
  198.     echo %Z >&! %_cwd\4Lvc-wrk\%LVCNAM
  199.     describe %_cwd\4Lvc-wrk\%LVCNAM "%LVCCOM"
  200.     set LVCCOM=
  201.     set LVCNAM=
  202.     goto LOOPIN
  203.  
  204. :LOOPEND
  205.     set LVCRCD=
  206.     set LVCEND=
  207.     del /q %_cwd\4Lvc-wrk\4LVCXTRC.0 >&! NUL
  208.     iff exist %_cwd\4Lvc-wrk\DESCRIPT.ION then
  209.         iff "%PROCEDURE"=="GETSOME" then
  210.             keystack !
  211.             select /A-d-h call 4LVCXTR (%_cwd\4Lvc-wrk\*.*)
  212.             keystack 00
  213.         else
  214.             keystack !
  215.             select /A-d-h call 4LVCDLT (%_cwd\4Lvc-wrk\*.*)
  216.             keystack 00
  217.         endiff
  218.     else
  219.         drawbox 1  0 13 79 0 whi on cya fill blu
  220.         iff "%LVCFMT" EQ "FIL" then
  221.             scrput  3 12     yel on blu No files found in archive %@upper[%Z] which match your request:
  222.             scrput  4 20     gre on blu         %@upper[%@name[%1]].000   thru   %@upper[%@name[%1]].999
  223.             scrput  5 12     yel on blu If you think this is an error, try running
  224.             scrput  6 20     gre on blu         PKZIP -q-vcbrd %@upper[%Z] %@upper[%@name[%1]].*
  225.             scrput  7 12     yel on blu manually from the command line.
  226.         else
  227.             scrput  4 12     yel on blu No files at all found in archive %@upper[%Z].
  228.             scrput  5 12     yel on blu If you think this is an error, try running
  229.             scrput  6 20     gre on blu         PKZIP -q-vcbrd %@upper[%Z]
  230.             scrput  7 12     yel on blu manually from the command line.
  231.         endiff
  232.         scrput  9  5     yel on blu If there are files present, then there is some problem writing to your
  233.         scrput 10  5     yel on blu disk (password/write protection, not enough space, etc.). Resolve the
  234.         scrput 11  5     yel on blu problem and try again. Press a key to continue.
  235.         inkey /W180 %%LVCRESP
  236.         set LVCRESP=
  237.         cls
  238.     endiff
  239.     del /qy %_cwd\4Lvc-wrk\*.* >&! NUL
  240.     return
  241.