home *** CD-ROM | disk | FTP | other *** search
/ The World of Computer Software / World_Of_Computer_Software-02-387-Vol-3of3.iso / z / zipeng10.zip / ZIPENG.CMD < prev    next >
OS/2 REXX Batch file  |  1993-03-21  |  64KB  |  1,734 lines

  1. /* The Zip Engine -- A shareware graphical approach to file zipping/unzipping */
  2. /* Copyright 1992-93 Kari Jackson and Bart Toulouse */
  3. '@ECHO OFF'
  4. signal on halt ; signal on syntax ; signal on error
  5. if rxfuncquery('vinit') then call rxfuncadd 'VInit', 'VREXX', 'VINIT'
  6. if VInit() = 'ERROR' then signal Error
  7. if rxfuncquery('sysloadfuncs') then call rxfuncadd 'SysLoadFuncs', 'RexxUtil', 'SysLoadFuncs'
  8. call sysloadfuncs
  9.  
  10. ReStart:
  11. drop ZIP UNZIP TEMPOLD DIROLD EXT ENDING DEFDIR MENUDEF SELPGM. VER ZOP UOP AOP TEXT SWITCH BG FG
  12. call vdialogpos 50,50
  13. rc = stream('ZIPENG.TEX', 'c', 'query exists')
  14. if rc<>'' then TEXT = rc
  15. else do
  16.    rc = syssearchpath('PATH','ZIPENG.TEX')
  17.    if rc<>'' then TEXT = rc
  18. end
  19. if TEXT = 'TEXT' then do
  20.    MSG.0 = 2
  21.    MSG.1 = 'ZIPENG.TEX message file not found.  Zip Engine cannot run  '
  22.    MSG.2 = 'unless this file is in the current directory or on the PATH.  '
  23.    call vmsgbox "Sorry!", MSG, 1
  24.    signal CleanUp
  25. end
  26. rc = stream('ZIPENG.INI', 'c', 'query exists')
  27. if rc<>'' then do
  28.    CFGFILE = rc
  29.    call ConfigFile
  30. end
  31. else do
  32.    rc = syssearchpath('PATH','ZIPENG.INI')
  33.    if rc<>'' then do
  34.       CFGFILE = rc
  35.       call ConfigFile
  36.    end
  37. end
  38. if (ZIP = 'ZIP')|(ZIP = '') then ZIP = syssearchpath('PATH','PKZip.EXE')
  39. if (UNZIP = 'UNZIP')|(UNZIP = '') then UNZIP = syssearchpath('PATH','PKUnzip.EXE')
  40. if (ZIP = '')|(UNZIP = '') then do
  41.    call ZipEdit.CMD TEXT
  42.    signal ReStart
  43. end
  44. if BG = 'BG' | BG = '' then BG = 'BLUE'
  45. if FG = 'FG' | FG = '' then FG = 'WHITE'
  46. if SWITCH = 'SWITCH' | SWITCH = '' then SWITCH = 'c'
  47. if TEMPOLD = 'TEMPOLD' then TEMPOLD = ''
  48. if DIROLD = 'DIROLD' then DIROLD = ''
  49. if EXT<>'CMD' then EXT = 'BAT'
  50. if ENDING<>'EXIT' then ENDING = 'Main' ; else ENDING = 'CleanUp'
  51. if DEFDIR = 'DEFDIR' then DEFDIR = '' ; else DEFDIR = DEFDIR'\'
  52. if (MENUDEF = 'MENUDEF')|(MENUDEF = '') then MENUDEF = SELPGM.1
  53. if (VER = 'VER')|(VER = '') then VER = 1
  54. if ZOP = 'ZOP' then ZOP = '' ; if UOP = 'UOP' then UOP = '' ; if AOP = 'AOP' then AOP = ''
  55. arg SOURCE
  56. Main:
  57. drop WINORG ABOUT BUTTON OPER DISKFILES MSG. ACTION LINE LEN DIRNAME2 VAR. NUMBER TEST. SELPGM. CHECK. NEWZIP
  58. if (AGAIN = 'YES')|(SOURCE = 'SOURCE') then SOURCE = ''
  59. EXECUTABLE = '' ; OPTIONS = '' ; DIRNAME = '' ; FILENAMES = ''
  60. SELPGM.0 = 10
  61. SELPGM.1 = 'Unzip a file'
  62. SELPGM.2 = 'Create a new .ZIP file'
  63. SELPGM.3 = 'Modify an existing .ZIP file'
  64. SELPGM.4 = 'View text files within a .ZIP'
  65. SELPGM.5 = 'View names of files inside a .ZIP'
  66. SELPGM.6 = 'Delete files within a .ZIP'
  67. SELPGM.7 = 'Test integrity of files inside a .ZIP'
  68. SELPGM.8 = 'Add a file as a comment to an existing .ZIP      '
  69. SELPGM.9 = 'Edit the ZIPENG configuration file'
  70. SELPGM.10 = 'About The Zip Engine'
  71. SELPGM.VSTRING = value(MENUDEF)
  72. BUTTON = vradiobox('Main Menu (CANCEL to exit Zip Engine)', SELPGM, 3)
  73. if BUTTON = 'CANCEL' then signal CleanUp
  74. drop BUTTON
  75. select
  76.    when SELPGM.VSTRING = SELPGM.1 then do
  77.       drop SELPGM.
  78.       EXECUTABLE = UNZIP
  79.       call WinBox
  80.       call UnZOpt
  81.       AGAIN = 'YES'
  82.       if (SOURCE = '')&(READY<>'YES') then call Source
  83.       drop READY
  84.       call WinBox
  85.       if DONT<>'NO' then do
  86.          DIRNAME = Target(DIROLD)
  87.          if DIRNAME = 'quit' then signal Main
  88.          if DIROLD = '' then DIROLD = DIRNAME
  89.          call WinBox
  90.       end
  91.       drop DONT
  92.       call Finally
  93.       if WINDOW=WINORG then call vclosewindow WINDOW
  94.       'start /win /b /'SWITCH COMMANDDONE
  95.       if ENDING = 'Main' then signal Main
  96.       if ENDING = 'CleanUp' then signal CleanUp
  97.    end
  98.    when SELPGM.VSTRING = SELPGM.2 then do
  99.       drop SELPGM.
  100.       EXECUTABLE = ZIP ; AGAIN = 'YES' ; NEWZIP = 'yes'
  101.       call WinBox
  102.       if SOURCE = '' then do until SOURCE<>'NoNe'
  103.          SOURCE = Source2()
  104.          if SOURCE = 'quit' then signal Main
  105.       end
  106.       call WinBox
  107.       call Target2
  108.       drop BUTTON MSG.
  109.       call WinBox
  110.       call ZOpt
  111.       call Finally
  112.       if WINDOW=WINORG then call vclosewindow WINDOW
  113.       'start /win /b /'SWITCH COMMANDDONE
  114.       if ENDING = 'Main' then signal Main
  115.       if ENDING = 'CleanUp' then signal CleanUp
  116.    end
  117.    when SELPGM.VSTRING = SELPGM.3 then do
  118.       drop SELPGM.
  119.       EXECUTABLE = ZIP ; AGAIN = 'YES'
  120.       call WinBox
  121.       if SOURCE = '' then do
  122.          call Source
  123.          call WinBox
  124.       end
  125.       call Target2
  126.       drop BUTTON MSG.
  127.       call WinBox
  128.       call ZOpt
  129.       call Finally
  130.       if WINDOW=WINORG then call vclosewindow WINDOW
  131.       'start /win /b /'SWITCH COMMANDDONE
  132.       if ENDING = 'Main' then signal Main
  133.       if ENDING = 'CleanUp' then signal CleanUp
  134.    end
  135.    when SELPGM.VSTRING = SELPGM.4 then do
  136.       drop SELPGM.
  137.       EXECUTABLE = UNZIP ; OPTIONS = strip(AOP)
  138.       call Password
  139.       if PS<>'PS' then OPTIONS = strip(OPTIONS PS)
  140.       drop PS
  141.       AGAIN = 'YES' ; WIN = 'NO'
  142.       if SOURCE = '' then call Source
  143.       if TEMPOLD<>'' then TEMPOLD = Validate(TEMPOLD)
  144.       drop DIR. WIN
  145.       if (TEMPOLD = '')|(TEMPOLD = 'NO WAY') then do
  146.          DIR.0 = 3
  147.          call linein TEXT,1
  148.          do 134
  149.             call linein TEXT
  150.          end
  151.          do y = 1 to 3
  152.             DIR.y = linein(TEXT)
  153.          end
  154.       end
  155.       do while (TEMPOLD = '')|(TEMPOLD = 'NO WAY')
  156.          call vinputbox 'Temporary directory:', DIR, 66, 1
  157.          TEMPOLD = Validate(DIR.VSTRING)
  158.       end
  159.       drop DIR.
  160.       DIRNAME = TEMPOLD
  161.       call ZipView.CMD TEXT'/'EXECUTABLE'/'OPTIONS'/'SOURCE'/'DIRNAME'/'EXT'/'BG'/'FG
  162.       if RESULT = 'error' then call CreateError
  163.       signal Main
  164.    end
  165.    when SELPGM.VSTRING = SELPGM.5 then do
  166.       drop SELPGM.
  167.       EXECUTABLE = ZIP ; OPTIONS = strip(AOP '-v')
  168.       call Order
  169.       AGAIN = 'YES'
  170.       if SOURCE = '' then call Source
  171.       call ViewOnly
  172.       call vclosewindow WINDOW
  173.       signal Main
  174.    end
  175.    when SELPGM.VSTRING = SELPGM.6 then do
  176.       drop SELPGM.
  177.       EXECUTABLE = ZIP ; OPTIONS = strip(AOP '-d')
  178.       call Temp
  179.       drop TEMPLEN
  180.       if TEMPOLD<>'' then OPTIONS = OPTIONS '-b'TEMPOLD
  181.       AGAIN = 'YES'
  182.       if SOURCE = '' then call Source
  183.       drop FILES.
  184.       if EXT = 'BAT' then FILES.0 = 10
  185.       if EXT = 'CMD' then FILES.0 = 7
  186.       call linein TEXT,1
  187.       call linein TEXT
  188.       do y = 1 to FILES.0
  189.          FILES.y = linein(TEXT)
  190.       end
  191.       BUTDEL = vinputbox("Files to Delete from the .ZIP File:", FILES, 40, 3)
  192.       drop DISKFILES
  193.       select
  194.          when BUTDEL = 'CANCEL' then do
  195.             OPER = 'delete'
  196.             call View
  197.             if DISKFILES = 'DISKFILES' then do
  198.                drop FILES. BUTDEL
  199.                signal Main
  200.             end
  201.             FILENAMES = DISKFILES
  202.             drop DISKFILES VAR. MSG. NUMBER
  203.          end
  204.          when (FILES.VSTRING = '')|(FILES.VSTRING = 'FILES.VSTRING') then do
  205.             if WINORG = WINDOW then call vclosewindow WINDOW
  206.             drop FILES. BUTDEL
  207.             signal Main
  208.          end
  209.          otherwise FILENAMES = FILES.VSTRING
  210.       end
  211.       drop BUTTON FILES. BUTDEL
  212.       LINE = strip(EXECUTABLE OPTIONS SOURCE FILENAMES) ; LEN = length(LINE)
  213.       call Finally
  214.       if WINDOW=WINORG then call vclosewindow WINDOW
  215.       'start /win /b /'SWITCH COMMANDDONE
  216.       if ENDING = 'Main' then signal Main
  217.       if ENDING = 'CleanUp' then signal CleanUp
  218.    end
  219.    when SELPGM.VSTRING = SELPGM.7 then do
  220.       drop SELPGM.
  221.       EXECUTABLE = UNZIP ; OPTIONS = strip(AOP '-t')
  222.       call Password
  223.       if PS<>'PS' then OPTIONS = OPTIONS PS
  224.       drop PS
  225.       AGAIN = 'YES'
  226.       if SOURCE = '' then call Source
  227.       call ViewOnly
  228.       call vclosewindow WINDOW
  229.       signal Main
  230.    end
  231.    when SELPGM.VSTRING = SELPGM.8 then do
  232.       drop SELPGM.
  233.       BUTTON = VFileBox('Select the comment file you want to add:', '*.*', COMMENT)
  234.       if BUTTON = 'CANCEL' then signal Main
  235.       AGAIN = 'YES'
  236.       if SOURCE = '' then call Source
  237.       LINE = ZIP strip(AOP '-z -x*.*') SOURCE '<' COMMENT.VSTRING ; LEN = length(LINE)
  238.       drop BUTTON COMMENT.
  239.       call Finally
  240.       if TEMPXFILE<>'TEMPXFILE' then do until rc = 0
  241.          rc = sysfiledelete(TEMPXFILE)
  242.          if rc<>0 then call syssleep 1
  243.       end
  244.       if right(TEMPOLD,1)='\' then TEMPXFILE = systempfilename(TEMPOLD'1?????.'EXT)
  245.       else TEMPXFILE = systempfilename(TEMPOLD'\1?????.'EXT)
  246.       call lineout TEMPXFILE,'@ECHO OFF'
  247.       if RESULT = 1 then call CreateError
  248.       call lineout TEMPXFILE,COMMANDDONE
  249.       call lineout TEMPXFILE,'ATTRIB -R' TEMPXFILE
  250.       call lineout TEMPXFILE,"REM If Zip Engine isn't running at this moment, delete this file."
  251.       call lineout TEMPXFILE
  252.       'ATTRIB +R' TEMPXFILE
  253.       'start /win /b /'SWITCH TEMPXFILE
  254.       if ENDING = 'Main' then signal Main
  255.       if ENDING = 'CleanUp' then signal CleanUp
  256.    end
  257.    when SELPGM.VSTRING = SELPGM.9 then do
  258.       drop SELPGM.
  259.       call ZipEdit.CMD TEXT
  260.       signal ReStart
  261.    end
  262.    when SELPGM.VSTRING = SELPGM.10 then do
  263.       drop SELPGM.
  264.       call ZipView.CMD 'About' TEXT'/'BG'/'FG
  265.       signal Main
  266.    end
  267.    otherwise nop
  268. end
  269. Error:
  270. Failure:
  271. Halt:
  272. Syntax:
  273.    MSG.0 = 4
  274.    MSG.1 = "I'm terribly sorry to report that there's been an"
  275.    MSG.2 = "error.  This Program is going to abort now.  Please"
  276.    MSG.3 = "write to the author and let me know what happened,"
  277.    MSG.4 = "and that the problem occurred in line number" SIGL"."
  278.    call vmsgbox "Uh-oh!", MSG, 1
  279. CleanUp:
  280.    if TEMPXFILE<>'TEMPXFILE' then do until rc = 0
  281.       rc = sysfiledelete(TEMPXFILE)
  282.       if rc<>0 then call syssleep 1
  283.    end
  284.    call vexit
  285.    say 'Thank you for using The Zip Engine.'
  286. exit
  287. ConfigFile:
  288.    rc = sysini(CFGFILE, 'zipeng', 'zipper')
  289.    if rc<>'ERROR:' then ZIP = rc
  290.    rc = sysini(CFGFILE, 'zipeng', 'unzipper')
  291.    if rc<>'ERROR:' then UNZIP = rc
  292.    rc = sysini(CFGFILE, 'zipeng', 'temporary directory')
  293.    if rc<>'ERROR:' then TEMPOLD = rc
  294.    rc = sysini(CFGFILE, 'zipeng', 'extract directory')
  295.    if rc<>'ERROR:' then DIROLD = rc
  296.    rc = sysini(CFGFILE, 'zipeng', 'extension')
  297.    if rc<>'ERROR:' then EXT = rc
  298.    rc = sysini(CFGFILE, 'zipeng', 'exit action')
  299.    if rc<>'ERROR:' then ENDING = rc
  300.    rc = sysini(CFGFILE, 'zipeng', 'default directory')
  301.    if rc<>'ERROR:' then DEFDIR = rc
  302.    rc = sysini(CFGFILE, 'zipeng', 'menu default')
  303.    if rc<>'ERROR:' then MENUDEF = rc
  304.    rc = sysini(CFGFILE, 'zipeng', 'version')
  305.    if rc<>'ERROR:' then VER = rc
  306.    rc = sysini(CFGFILE, 'zipeng', 'zip options')
  307.    if rc<>'ERROR:' then ZOP = rc
  308.    rc = sysini(CFGFILE, 'zipeng', 'unzip options')
  309.    if rc<>'ERROR:' then UOP = rc
  310.    rc = sysini(CFGFILE, 'zipeng', 'global options')
  311.    if rc<>'ERROR:' then AOP = rc
  312.    rc = sysini(CFGFILE, 'zipeng', 'start switch')
  313.    if rc<>'ERROR:' then SWITCH = rc
  314.    rc = sysini(CFGFILE, 'zipeng', 'background')
  315.    if rc<>'ERROR:' then BG = rc
  316.    rc = sysini(CFGFILE, 'zipeng', 'foreground')
  317.    if rc<>'ERROR:' then FG = rc
  318.    drop CFGFILE rc
  319. return
  320. WinBox:
  321.    if WINORG<>WINDOW then do
  322.       POS.left = 2 ; POS.right = 98 ; POS.top = 25 ; POS.bottom = 10
  323.       WINDOW = vopenwindow('(Zip Engine) Watch the Command Line Being Built:', BG, POS)
  324.       call vsetfont WINDOW, 'SYSTEM', 10
  325.       call vforecolor WINDOW, FG
  326.       drop POS.
  327.       WINORG = WINDOW
  328.    end
  329.    LINE = strip(EXECUTABLE OPTIONS SOURCE DIRNAME FILENAMES) ; LEN = length(LINE)
  330.    call vclearwindow WINDOW
  331.    select
  332.       when LEN<73 then do
  333.          call vsay WINDOW, 5, 600, LINE
  334.          call vsay WINDOW, 950, 200, LEN
  335.       end
  336.       when LEN<145 then do
  337.          call vsay WINDOW, 5, 600, left(LINE,72)
  338.          call vsay WINDOW, 5, 400, substr(LINE,73)
  339.          call vsay WINDOW, 950, 200, LEN
  340.       end
  341.       otherwise do
  342.          call vsay WINDOW, 5, 600, left(LINE,72)
  343.          call vsay WINDOW, 5, 400, substr(LINE,73,72)
  344.          call vsay WINDOW, 5, 200, substr(LINE,145)
  345.          if LEN<216 then call vsay WINDOW, 950, 200, LEN
  346.       end
  347.    end
  348. return
  349. Validate:
  350.    procedure expose ROUTINE
  351.    arg VALID
  352.    if (VALID = '')|(VALID = '\') then return VALID
  353.    if (VALID = '.')|(VALID = '.\') then return directory()
  354.    if (VALID = '..')|(VALID = '..\') then do
  355.       SLASH = lastpos('\',directory())
  356.       VALID = left(directory(),SLASH-1)
  357.       if substr(VALID,2) = ':' then VALID = VALID'\'
  358.       return VALID
  359.    end
  360.    VALIDLEN = length(VALID)
  361.    if (substr(VALID,2) = ':')&(datatype(left(VALID,1),'M') = 1) then return VALID
  362.    if (substr(VALID,2) = ':\')&(datatype(left(VALID,1),'M') = 1) then return VALID
  363.    if right(VALID,1) = '\' then VALID = left(VALID,VALIDLEN-1)
  364.    call sysfiletree VALID, 'TEST'
  365.    if TEST.0 = 1 then return VALID
  366.    if (ROUTINE<>'Target')&(WIN<>'NO') then do
  367.       MSG.0 = 3
  368.       MSG.1 = 'Please specify a directory name that exists.'
  369.       MSG.2 = VALID
  370.       MSG.3 = 'does not exist.'
  371.       call vmsgbox 'Sorry!', MSG, 1
  372.    end
  373. return 'NO WAY'
  374. Source:
  375.    drop FNAME.
  376.    BUTTON = vfilebox('Select a .ZIP File to Act Upon:', DEFDIR'*.zip', FNAME)
  377.    if BUTTON = 'CANCEL' then do
  378.       if WINORG = WINDOW then call vclosewindow WINDOW
  379.       drop FNAME.
  380.       signal Main
  381.    end
  382.    SOURCE = FNAME.VSTRING
  383.    drop BUTTON FNAME.
  384. return
  385. Source2:
  386.    procedure expose WINDOW DEFDIR TEXT
  387.    DIR.0 = 9
  388.    call linein TEXT,1
  389.    do 12
  390.       call linein TEXT
  391.    end
  392.    do y = 1 to 9
  393.       DIR.y = linein(TEXT)
  394.    end
  395.    DIR.VSTRING = DEFDIR
  396.    BUTTON = vinputbox('.ZIP File to Create:', DIR, 50, 3)
  397.    if BUTTON = 'CANCEL' then do
  398.       call vclosewindow WINDOW
  399.       drop DIR.
  400.       return 'quit'
  401.    end
  402.    SOURCE = DIR.VSTRING
  403.    if (SOURCE = '')|(SOURCE = 'DIR.VSTRING') then return 'NoNe'
  404.    SLASH = lastpos('\',SOURCE)
  405.    if SLASH>1 then do
  406.       DIRN = left(SOURCE,SLASH-1)
  407.       FILEN = substr(SOURCE,SLASH+1)
  408.       if FILEN = '' then return 'NoNe'
  409.       DIRN = Validate(DIRN)
  410.       if DIRN = 'NO WAY' then return 'NoNe'
  411.       if right(DIRN,1) = '\' then SOURCE = DIRN''FILEN
  412.       else SOURCE = DIRN'\'FILEN
  413.    end
  414.    if (SLASH = 0)&(substr(SOURCE,2,1)<>':') then SOURCE = directory()'\'SOURCE
  415.    else if SLASH = 0 then do
  416.       if right(SOURCE,1) = ':' then return 'NoNe'
  417.       CURDIR = directory()
  418.       call directory left(SOURCE,2)
  419.       THAT = directory()
  420.       call directory(CURDIR)
  421.       if right(THAT,1)<>'\' then SOURCE = THAT'\'substr(SOURCE,3)
  422.       else SOURCE = THAT''substr(SOURCE,3)
  423.       drop THAT
  424.    end
  425. return SOURCE
  426. Target:
  427.    procedure expose SOURCE WINDOW TEXT
  428.    arg DIROLD
  429.    DIR.0 = 10
  430.    call linein TEXT,1
  431.    do 22
  432.       call linein TEXT
  433.    end
  434.    do y = 1 to 10
  435.       DIR.y = linein(TEXT)
  436.    end
  437.    DIR.VSTRING = DIROLD
  438.    BUTTON = vinputbox('Target Directory Name:', DIR, 66, 3)
  439.    if BUTTON = 'CANCEL' then do
  440.       call vclosewindow WINDOW
  441.       return 'quit'
  442.    end
  443.    if DIR.VSTRING = '' then do
  444.       call Target DIROLD
  445.       return RESULT
  446.    end
  447.    if (right(DIR.VSTRING,2) = '\$')|(DIR.VSTRING = '$')|(right(DIR.VSTRING,2) = ':$') then do
  448.       ABC = lastpos('\',SOURCE)
  449.       DEF = lastpos('.',SOURCE)
  450.       if DEF>0 then NEWDIR = substr(SOURCE,ABC+1, DEF-ABC-1)
  451.       else NEWDIR = substr(SOURCE,ABC+1)
  452.       if length(DIR.VSTRING)>1 then DIR.VSTRING = left(DIR.VSTRING,length(DIR.VSTRING)-1)''NEWDIR
  453.       else DIR.VSTRING = NEWDIR
  454.    end
  455.    ROUTINE = 'Target'
  456.    DIRNAME = Validate(DIR.VSTRING)
  457.    drop ROUTINE
  458.    if DIRNAME = 'NO WAY' then do
  459.       DIRNAME = DIR.VSTRING
  460.       SLASH = lastpos('\',DIRNAME)
  461.       select
  462.          when (SLASH = 0)&(substr(DIRNAME,2,1) = ':') then do
  463.             CURDIR = directory()
  464.             call directory left(DIRNAME,2)
  465.             PARENT = directory()
  466.             call directory(CURDIR)
  467.             NEWDIR = substr(DIRNAME,3)
  468.          end
  469.          when SLASH = 0 then do
  470.             PARENT = directory()
  471.             NEWDIR = DIRNAME
  472.          end
  473.          when SLASH = 1 then do
  474.             PARENT = '\'
  475.             NEWDIR = substr(DIRNAME,2)
  476.          end
  477.          when (SLASH = 3)&(substr(DIRNAME,2,1) = ':') then do
  478.             PARENT = left(DIRNAME,3)
  479.             NEWDIR = substr(DIRNAME,4)
  480.          end
  481.          otherwise do
  482.             PARENT = left(DIRNAME,SLASH-1)
  483.             NEWDIR = substr(DIRNAME,SLASH+1)
  484.             ROUTINE = 'Target'
  485.             THIS = Validate(PARENT)
  486.             drop ROUTINE
  487.             if THIS = 'NO WAY' then do
  488.                MSG.0 = 2
  489.                MSG.1 = DIRNAME "does not exist, nor can we create"
  490.                MSG.2 = "it since" PARENT "doesn't exist either."
  491.                call vmsgbox 'Sorry!', MSG, 1
  492.                call Target DIROLD
  493.                return RESULT
  494.             end
  495.             PARENT = THIS
  496.          end
  497.       end
  498.       MSG.0 = 3
  499.       if PARENT='\' then MSG.1 = '\'NEWDIR "does not exist, but" PARENT "does.         "
  500.       else MSG.1 = PARENT'\'NEWDIR "does not exist, but" PARENT "does.         "
  501.       MSG.2 = "Do you want to create" NEWDIR "under the" PARENT
  502.       MSG.3 = "directory?  If not, choose NO to return to the input box."
  503.       BUT = vmsgbox("Create Directory?", MSG, 6)
  504.       if BUT = 'NO' then do
  505.          call Target DIROLD
  506.          return RESULT
  507.       end
  508.       else do
  509.          if (right(PARENT,1) = '\')|(right(PARENT,1) = ':') then DIRNAME = PARENT''NEWDIR
  510.          else DIRNAME = PARENT'\'NEWDIR
  511.          rc = sysmkdir(DIRNAME)
  512.          if rc<>0 then do
  513.             MSG.0 = 2
  514.             MSG.1 = "Sorry, we were not able to create" DIRNAME
  515.             MSG.2 = "Let's go back to the input box."
  516.             call vmsgbox "Oops!", MSG, 1
  517.             call Target DIROLD
  518.             return RESULT
  519.          end
  520.       end
  521.    end
  522. return DIRNAME
  523. Target2:
  524.    drop MSG.
  525.    if NEWZIP<>'yes' then MSG.0 = 9
  526.    else MSG.0 = 3
  527.    call linein TEXT,1
  528.    do 33
  529.       call linein TEXT
  530.    end
  531.    do y = 1 to MSG.0
  532.       if y = 4 then MSG.4 = ''
  533.       else MSG.y = linein(TEXT)
  534.    end
  535.    BUTTON = vinputbox("Directory of Files to Zip:", MSG, 40, 3)
  536.    if (NEWZIP<>'yes')&(BUTTON = 'CANCEL') then do
  537.       DIRNAME = '-x*.*'
  538.       return
  539.    end
  540.    if (BUTTON = 'CANCEL')&(NEWZIP = 'yes') then do
  541.       call vclosewindow WINDOW
  542.       signal Main
  543.    end
  544.    drop BUTTON
  545.    if (MSG.VSTRING = '')|(MSG.VSTRING = 'MSG.VSTRING') then do
  546.       call Target2
  547.       return
  548.    end
  549.    DIRNAME = Validate(MSG.VSTRING)
  550.    drop MSG.
  551.    if DIRNAME = 'NO WAY' then do
  552.       call Target2
  553.       return
  554.    end
  555.    if (right(DIRNAME,1)<>'\')&(right(DIRNAME,1)<>':') then DIRNAME = DIRNAME'\'
  556.    DIRNAME2 = DIRNAME
  557.    if EXT = 'BAT' then MSG.0 = 10
  558.    if EXT = 'CMD' then MSG.0 = 7
  559.    call linein TEXT,1
  560.    do 42
  561.       call linein TEXT
  562.    end
  563.    do y = 1 to MSG.0
  564.       MSG.y = linein(TEXT)
  565.    end
  566.    MSG.VSTRING = '*.*'
  567.    BUTTON = vinputbox('Files to Zip:', MSG, 55, 3)
  568.    if BUTTON = 'CANCEL' then do
  569.       ACTION = 'zip'
  570.       drop DISKFILES BUTTON MSG.
  571.       call DiskFiles
  572.       if (DISKFILES<>'DISKFILES')&(DISKFILES<>'') then DIRNAME = DISKFILES
  573.       else do
  574.          call Target2
  575.          return
  576.       end
  577.       drop DISKFILES VAR. MSG. NUMBER
  578.    end
  579.    else do
  580.       if MSG.VSTRING = '' then do
  581.          call Target2
  582.          return
  583.       end
  584.       do t = 1 while MSG.VSTRING<>''
  585.          select
  586.             when left(MSG.VSTRING,1) = '"' then do
  587.                parse var MSG.VSTRING . '"' NAME.t '"' MSG.VSTRING
  588.                NAME.t = '"'||NAME.t||'"'
  589.             end
  590.             when left(MSG.VSTRING,1) = "'" then do
  591.                parse var MSG.VSTRING . "'" NAME.t "'" MSG.VSTRING
  592.                NAME.t = "'"||NAME.t||"'"
  593.             end
  594.             otherwise parse var MSG.VSTRING NAME.t MSG.VSTRING
  595.          end
  596.          MSG.VSTRING = strip(MSG.VSTRING)
  597.          NAME.0 = t
  598.       end
  599.       if symbol('NAME.0') = 'VAR' then do t = 1 to NAME.0
  600.          MSG.VSTRING = strip(MSG.VSTRING DIRNAME||NAME.t)
  601.       end
  602.       DIRNAME = MSG.VSTRING
  603.       drop NAME. BUTTON MSG.
  604.    end
  605. return
  606. Order:
  607.    ORDER.0 = 6
  608.    ORDER.1 = 'd = date'
  609.    ORDER.2 = 'e = extension'
  610.    ORDER.3 = 'n = name'
  611.    ORDER.4 = 'o = original'
  612.    ORDER.5 = 'p = percentage'
  613.    ORDER.6 = 's = size'
  614.    ORDER.VSTRING = ORDER.4
  615.    call vradiobox 'Show files in order of:', ORDER, 1
  616.    OPTIONS = OPTIONS||left(ORDER.VSTRING,1)
  617.    drop ORDER.
  618.    EXTRA.0 = 4
  619.    EXTRA.1 = 'b = brief'
  620.    EXTRA.2 = 'c = comments'
  621.    EXTRA.3 = 'r = reverse'
  622.    EXTRA.4 = 't = technical'
  623.    call vcheckbox 'Optional:', EXTRA, OP2, 1
  624.    do r = 1 to OP2.0
  625.       OPTIONS = OPTIONS||left(OP2.r,1)
  626.    end
  627.    drop EXTRA. OP2.
  628. return
  629. Password:
  630.    call vdialogpos 25,35
  631.    PASS.0 = 1
  632.    PASS.1 = 'Asterisks will echo for security reasons:'
  633.    PASSWORD.0 = 1
  634.    PASSWORD.1 = ''
  635.    PASSBUT = vmultbox("Enter the file's password, if it's encrypted:", PASS, 25, 1, PASSWORD, 3)
  636.    if (VER = 2)&(PASSBUT = 'OK') then PS = '-s'PASSWORD.1
  637.    if (VER = 1)&(PASSWORD.1<>'') then PS = '-s'PASSWORD.1
  638.    drop PASS. PASSWORD. PASSBUT
  639.    call vdialogpos 50,50
  640. return
  641. Finally:
  642.    if (EXT = 'BAT')&(LEN>100) then do
  643.       MSG.0 = 10
  644.       call linein TEXT,1
  645.       do 53
  646.          call linein TEXT
  647.       end
  648.       do y = 1 to 10
  649.          MSG.y = linein(TEXT)
  650.       end
  651.       call vmsgbox "Careful!", MSG, 1
  652.       drop MSG.
  653.    end
  654.    call linein TEXT,1
  655.    do 64
  656.       call linein TEXT
  657.    end
  658.    POS.left = 3 ; POS.right = 97 ; POS.top = 95 ; POS.bottom = 60
  659.    WINDOW2 = vopenwindow('(Zip Engine) Finished building command line....', BG, POS)
  660.    call vsetfont WINDOW2, 'SYSTEM', 10
  661.    call vforecolor WINDOW2, FG
  662.    do q = 930 to 30 by -100
  663.       call vsay WINDOW2, 15, q, linein(TEXT)
  664.    end
  665.    drop F1. F2.
  666.    F1.0 = 7 ; F2.0 = 7
  667.    F1. = ' ' ; F2. = ' '
  668.    F1.0 = 1 ; F2.0 = 1
  669.    F2.1 = left(LINE,60)
  670.    if LEN>60 then do
  671.       F2.2 = substr(LINE,61,60)
  672.       F1.0 = 2 ; F2.0 = 2
  673.    end
  674.    if LEN>120 then do
  675.       F2.3 = substr(LINE,121,60)
  676.       F1.0 = 3 ; F2.0 = 3
  677.    end
  678.    if LEN>180 then do
  679.       F2.4 = substr(LINE,181,60)
  680.       F1.0 = 4 ; F2.0 = 4
  681.    end
  682.    if LEN>240 then do
  683.       F2.5 = substr(LINE,241,60)
  684.       F1.0 = 5 ; F2.0 = 5
  685.    end
  686.    if LEN>300 then do
  687.       F2.6 = substr(LINE,301,60)
  688.       F1.0 = 6 ; F2.0 = 6
  689.    end
  690.    if LEN>360 then do
  691.       F2.7 = substr(LINE,361,60)
  692.       F1.0 = 7 ; F2.0 = 7
  693.    end
  694.    call vdialogpos 50,40
  695.    BUTTON = vmultbox('Edit your Command Line, if desired:', F1, 80, 0, F2, 3)
  696.    call vdialogpos 50,50
  697.    call vclosewindow WINDOW2
  698.    if BUTTON = 'OK' then do
  699.       COMMANDDONE = strip(F2.1''F2.2''F2.3''F2.4''F2.5''F2.6''F2.7)
  700.       drop BUTTON F1. F2.
  701.       return
  702.    end
  703.    MSG.0 = 3
  704.    call linein TEXT
  705.    do y = 1 to 3
  706.       MSG.y = linein(TEXT)
  707.    end
  708.    BUTTON = vmsgbox('Cancel?', MSG, 3)
  709.    if BUTTON = 'OK' then do
  710.       COMMANDDONE = strip(F2.1''F2.2''F2.3''F2.4''F2.5''F2.6''F2.7)
  711.       drop BUTTON MSG. F1. F2.
  712.       return
  713.    end
  714.    drop BUTTON MSG. F1. F2.
  715.    if WINORG = WINDOW then call vclosewindow WINDOW
  716.    signal Main
  717. return
  718. ZOpt:
  719.    OPTIONS = strip(AOP ZOP)
  720.    if OPTIONS<>'' then call WinBox
  721.    if VER = 2 then do
  722.       ZIPOP.0 = 10
  723.       ZIPOP.1 = '-& = span new .ZIP file across disks if necessary ....'
  724.       ZIPOP.2 = '-a+= turn off Archive attributes of zipped files'
  725.       ZIPOP.3 = '-b = put temp files somewhere other than current drive ....      '
  726.       ZIPOP.4 = '-c = comments ....'
  727.       ZIPOP.5 = '-m = move files into .ZIP (delete from source) ....'
  728.       ZIPOP.6 = '-x = exclude certain files ....'
  729.       ZIPOP.7 = '     pathnames and subdirectories ....'
  730.       ZIPOP.8 = '     specify date stamp for .ZIP file ....'
  731.       ZIPOP.9 = '     zip only files that have changed ....'
  732.       ZIPOP.10 = '     further options ....'
  733.    end
  734.    if VER = 1 then do
  735.       ZIPOP.0 = 8
  736.       ZIPOP.1 = '-b = put temp files somewhere other than current drive ....      '
  737.       ZIPOP.2 = '-c = comments ....'
  738.       ZIPOP.3 = '-m = move files into .ZIP (delete from source) ....'
  739.       ZIPOP.4 = '-x = exclude certain files ....'
  740.       ZIPOP.5 = '     pathnames and subdirectories ....'
  741.       ZIPOP.6 = '     specify date stamp for .ZIP file ....'
  742.       ZIPOP.7 = '     zip only files that have changed ....'
  743.       ZIPOP.8 = '     further options ....'
  744.    end
  745.    drop PAR.
  746.    BUTTON = vcheckbox('Zip Special OPTIONAL Switches:', ZIPOP, PAR, 3)
  747.    if BUTTON = 'CANCEL' then do
  748.       call vclosewindow WINDOW
  749.       signal Main
  750.    end
  751.    drop BUTTON
  752.    do i = 1 to PAR.0
  753.       if left(PAR.i,1) = '-' then PAR.i = left(PAR.i,2)
  754.       else select
  755.          when substr(PAR.i,6,1) = 'p' then PAR.i = 'paths'
  756.          when substr(PAR.i,6,1) = 's' then PAR.i = 'date'
  757.          when substr(PAR.i,6,1) = 'z' then PAR.i = 'only'
  758.          when substr(PAR.i,6,1) = 'f' then PAR.i = 'further'
  759.          otherwise nop
  760.       end
  761.    end
  762.    drop ZIPOP.
  763.    do i = 1 to PAR.0
  764.       select
  765.          when PAR.i = '-&' then do
  766.             if NEWZIP<>'yes' then call CantUse
  767.             else do
  768.                SPAN2.0 = 9
  769.                SPAN2.1 = "f  = quick format target disk first"
  770.                SPAN2.2 = "fl = quick format double density in HD drive"
  771.                SPAN2.3 = "u  = full format target disk first"
  772.                SPAN2.4 = "ul = full format double density in HD drive"
  773.                SPAN2.5 = "w  = wipe all files from target disk first"
  774.                SPAN2.6 = "  Do NOT choose more than one of the above!       "
  775.                SPAN2.7 = " "
  776.                SPAN2.8 = "v  = verify that target disk is readable"
  777.                SPAN2.9 = "s  = zip all files on entire drive"
  778.                SPAN4.0 = 1
  779.                SPAN4.1 = SPAN2.8
  780.                BUTTON = vcheckbox('Additional OPTIONAL parameters:', SPAN2, SPAN4, 3)
  781.                if BUTTON = 'OK' then do r = 1 to SPAN4.0
  782.                   PAR.i = PAR.i||strip(left(SPAN4.r,2))
  783.                end
  784.                else PAR.i = ' '
  785.                drop SPAN2. SPAN4. BUTTON
  786.                if right(PAR.i,1) = 's' then do
  787.                   SPAN3.0 = 3
  788.                   SPAN3.1 = "Specify the drive letter of the drive you want   "
  789.                   SPAN3.2 = "to zip.  You may leave this line blank if you   "
  790.                   SPAN3.3 = "want to zip the" left(directory(),2) "drive."
  791.                   SPAN3.VSTRING = ''
  792.                   do until (datatype(left(SPAN3.VSTRING,1),'M'))|(SBUT = 'CANCEL')|(SPAN3.VSTRING = '')
  793.                      SBUT = vinputbox("Drive to Zip:", SPAN3, 2, 3)
  794.                   end
  795.                   if SBUT = 'CANCEL' then PAR.i = left(PAR.i,length(PAR.i)-1)
  796.                   else PAR.i = PAR.i''left(SPAN3.VSTRING,1)
  797.                   PATHS = wordpos('paths',PAR.1 PAR.2 PAR.3 PAR.4 PAR.5 PAR.6 PAR.7 PAR.8)
  798.                   if (SBUT = 'OK')&(PATHS>0) then do
  799.                      PAR.PATHS = ' '
  800.                      MSG.0 = 5
  801.                      call linein TEXT,1
  802.                      do 79
  803.                         call linein TEXT
  804.                      end
  805.                      do y = 1 to 5
  806.                         MSG.y = linein(TEXT)
  807.                      end
  808.                      call vmsgbox "Sorry!", MSG, 1
  809.                   end
  810.                   drop PATHS MSG.
  811.                end
  812.                drop BUTTON SPAN3. SBUT
  813.                OPTIONS = strip(OPTIONS PAR.i)
  814.                call WinBox
  815.             end
  816.          end
  817.          when PAR.i = '-a' then do
  818.             OPTIONS = strip(OPTIONS '-a+')
  819.             call WinBox
  820.          end
  821.          when PAR.i = 'paths' then do
  822.             PATHS.0 = 4
  823.             PATHS.1 = '-r = recurse subdirectories but do not include pathnames'
  824.             PATHS.2 = '-rp= recurse and include pathnames recursed into'
  825.             PATHS.3 = '-rP= recurse and include pathnames specified and recursed into'
  826.             PATHS.4 = '-P = include pathnames specified but do not recurse subdirectories       '
  827.             PATHS.VSTRING = PATHS.2
  828.             BUTTON = vradiobox('Select:', PATHS, 3)
  829.             PAR.i = strip(left(PATHS.VSTRING,3))
  830.             if BUTTON = 'CANCEL' then PAR.i = ''
  831.             drop BUTTON PATHS.
  832.             OPTIONS = strip(OPTIONS PAR.i)
  833.             call WinBox
  834.          end
  835.          when PAR.i = '-b' then do
  836.             if NEWZIP = 'yes' then call CantUse
  837.             else do
  838.                call Temp
  839.                drop TEMPLEN
  840.                if TEMPOLD<>'' then OPTIONS = strip(OPTIONS '-b'TEMPOLD)
  841.                call WinBox
  842.             end
  843.          end
  844.          when PAR.i = '-c' then do
  845.             PAR.i = ''
  846.             drop COMMENTS3. COMMENTS.
  847.             COMMENTS3.0 = 5
  848.             COMMENTS3.1 = '-c = Comments for all files in .ZIP'
  849.             COMMENTS3.2 = '-C = Comments for newly-added files in .ZIP'
  850.             COMMENTS3.3 = '  Do NOT choose more than one of the above!       '
  851.             COMMENTS3.4 = ' '
  852.             COMMENTS3.5 = '-z = Comment for the .ZIP file itself'
  853.             BUTTON = vcheckbox('Comments:', COMMENTS3, COMMENTS, 3)
  854.             if BUTTON = 'OK' then do y = 1 to COMMENTS.0
  855.                PAR.i = strip(PAR.i left(COMMENTS.y,2))
  856.             end
  857.             drop BUTTON COMMENTS. COMMENTS3.
  858.             if (DIRNAME<>'')&(PAR.i<>'') then do
  859.                drop OK
  860.                do x = 1 to 10
  861.                   if wordpos('-a+',PAR.x)>0 then OK = 'YES'
  862.                   if wordpos('-m',PAR.x)>0 then OK = 'YES'
  863.                   if wordpos('only',PAR.x)>0 then OK = 'YES'
  864.                end
  865.                if OK<>'YES' then PAR.i = PAR.i '-a'
  866.                drop OK
  867.             end
  868.             OPTIONS = strip(OPTIONS PAR.i)
  869.             call WinBox
  870.          end
  871.          when PAR.i = '-m' then do
  872.             MOVE.0 = 3
  873.             MOVE.1 = '  = Move all files'
  874.             MOVE.2 = 'f = Move only later copies of existing files   '
  875.             MOVE.3 = 'u = Move only later copies and new files'
  876.             MOVE.VSTRING = MOVE.1
  877.             if VER = 2 then do
  878.                MOVE.0 = 6
  879.                MOVE.4 = "- = Move all but don't remove directories"
  880.                MOVE.5 = "-f= Freshen but don't remove directories"
  881.                MOVE.6 = "-u= Update but don't remove directories"
  882.                MOVE.VSTRING = MOVE.4
  883.             end
  884.             BUTTON = vradiobox('Move which files?', MOVE, 3)
  885.             select
  886.                when BUTTON = 'CANCEL' then PAR.i = ''
  887.                when MOVE.VSTRING = MOVE.2 then PAR.i = '-mf'
  888.                when MOVE.VSTRING = MOVE.3 then PAR.i = '-mu'
  889.                when MOVE.VSTRING = MOVE.4 then PAR.i = '-m-'
  890.                when MOVE.VSTRING = MOVE.5 then PAR.i = '-m-f'
  891.                when MOVE.VSTRING = MOVE.6 then PAR.i = '-m-u'
  892.                otherwise nop
  893.             end
  894.             drop BUTTON MOVE.
  895.             OPTIONS = strip(OPTIONS PAR.i)
  896.             call WinBox
  897.          end
  898.          when PAR.i = '-x' then do
  899.             PAR.i = ''
  900.             drop FILES.
  901.             if EXT = 'BAT' then FILES.0 = 10
  902.             if EXT = 'CMD' then FILES.0 = 7
  903.             call linein TEXT,1
  904.             do 85
  905.                call linein TEXT
  906.             end
  907.             do y = 1 to FILES.0
  908.                FILES.y = linein(TEXT)
  909.             end
  910.             BUTEX = vinputbox("Files to Exclude from the .ZIP File:", FILES, 40, 3)
  911.             if BUTEX = 'CANCEL' then do
  912.                ACTION = 'exclude'
  913.                drop DISKFILES
  914.                call DiskFiles
  915.                if DISKFILES = 'DISKFILES' then DISKFILES = ''
  916.                FILES.VSTRING = DISKFILES
  917.                drop VAR. MSG. NUMBER DISKFILES
  918.             end
  919.             do t = 1 while FILES.VSTRING<>''
  920.                select
  921.                   when left(FILES.VSTRING,1) = '"' then do
  922.                      parse var FILES.VSTRING . '"' NAME.t '"' FILES.VSTRING
  923.                      NAME.t = '"'||NAME.t||'"'
  924.                   end
  925.                   when left(FILES.VSTRING,1) = "'" then do
  926.                      parse var FILES.VSTRING . "'" NAME.t "'" FILES.VSTRING
  927.                      NAME.t = "'"||NAME.t||"'"
  928.                   end
  929.                   otherwise parse var FILES.VSTRING NAME.t FILES.VSTRING
  930.                end
  931.                FILES.VSTRING = strip(FILES.VSTRING)
  932.                NAME.0 = t
  933.             end
  934.             select
  935.                when (symbol('NAME.0') = 'VAR')&(BUTEX = 'OK') then do t = 1 to NAME.0
  936.                   PAR.i = strip(PAR.i '-x'||DIRNAME2||NAME.t)
  937.                end
  938.                when symbol('NAME.0') = 'VAR' then do t = 1 to NAME.0
  939.                   PAR.i = strip(PAR.i '-x'||DIRNAME2||filespec('name',NAME.t))
  940.                end
  941.                otherwise nop
  942.             end
  943.             OPTIONS = strip(OPTIONS PAR.i)
  944.             call WinBox
  945.             drop BUTEX FILES. DISKFILES NAME.
  946.          end
  947.          when PAR.i = 'date' then do
  948.             DATE.0 = 2
  949.             DATE.1 = '-k = keep date stamp of existing .ZIP file'
  950.             DATE.2 = '-o = use date stamp of latest file inside .ZIP    '
  951.             DATE.VSTRING = DATE.2
  952.             THAT = vradiobox('Which Date?', DATE, 3)
  953.             if THAT = 'OK' then PAR.i = left(DATE.VSTRING,2)
  954.             if (PAR.i = '-k')&(NEWZIP = 'yes') then call CantUse
  955.             drop DATE. THAT
  956.             if (PAR.i<>'')&(PAR.i<>'date') then do
  957.                OPTIONS = strip(OPTIONS PAR.i)
  958.                call WinBox
  959.             end
  960.          end
  961.          when PAR.i = 'only' then do
  962.             ONLY.1 = '-f = freshen files already in .ZIP file'
  963.             ONLY.2 = '-i = backup files by archive attributes (turn them off)   '
  964.             if VER = 1 then do
  965.                ONLY.0 = 4
  966.                ONLY.3 = '-t = zip only files modified on or after date ....'
  967.                ONLY.4 = '-u = update existing .ZIP with new and modified files          '
  968.             end
  969.             else do
  970.                ONLY.0 = 5
  971.                ONLY.3 = '-i-= backup files by archive attributes (leave them on)'
  972.                ONLY.4 = '-t = zip files according to their last modification date ....  '
  973.                ONLY.5 = '-u = update existing .ZIP with new and modified files'
  974.             end
  975.             ONLY.VSTRING = ONLY.2
  976.             THAT = vradiobox('Which Files?', ONLY, 3)
  977.             PAR.i = left(ONLY.VSTRING,2)
  978.             if THAT = 'CANCEL' then PAR.i = ''
  979.             select
  980.                when (VER = 1)&(PAR.i = '-t') then do
  981.                   drop DAT. BUTTON
  982.                   DAT.0 = 3
  983.                   call linein TEXT,1
  984.                   do 122
  985.                      call linein TEXT
  986.                   end
  987.                   do y = 1 to 3
  988.                      DAT.y = linein(TEXT)
  989.                   end
  990.                   do until (BUTTON = 'CANCEL')|((TEST = 1)&(length(DAT.VSTRING) = 6))|(DAT.VSTRING = '')
  991.                      BUTTON = vinputbox('Input the Date:', DAT, 10, 3)
  992.                      TEST = datatype(DAT.VSTRING,'W')
  993.                   end
  994.                   drop TEST
  995.                   PAR.i = '-t'DAT.VSTRING
  996.                   if BUTTON = 'CANCEL' then PAR.i = ''
  997.                end
  998.                when PAR.i = '-t' then PAR.i = ZipView.CMD('Date2')
  999.                when (VER = 2)&(PAR.i = ONLY.3) then PAR.i = '-i-'
  1000.                when (NEWZIP = 'yes')&((PAR.i = '-u')|(PAR.i = '-f')) then call CantUse
  1001.                otherwise nop
  1002.             end
  1003.             drop BUTTON ONLY. THAT DAT.
  1004.             OPTIONS = strip(OPTIONS PAR.i)
  1005.             call WinBox
  1006.          end
  1007.          when PAR.i = 'further' then do
  1008.             drop PAR2.
  1009.             if VER = 2 then do
  1010.                OTHER.0 = 8
  1011.                OTHER.1 = '-@ = generate list file instead of zipping'
  1012.                OTHER.2 = '-! = include authenticity validation info'
  1013.                OTHER.3 = '-$ = store volume label in .ZIP file ....'
  1014.                OTHER.4 = '-e = choose compression method ....'
  1015.                OTHER.5 = '-q = enable ANSI support for comments'
  1016.                OTHER.6 = '-s = password ....'
  1017.                OTHER.7 = '     attributes ....'
  1018.                OTHER.8 = '     troubleshooting and compatibility options ....   '
  1019.             end
  1020.             if VER = 1 then do
  1021.                OTHER.0 = 7
  1022.                OTHER.1 = '-! = include authenticity validation info'
  1023.                OTHER.2 = '-$ = store volume label in .ZIP file ....'
  1024.                OTHER.3 = '-e = choose compression method ....'
  1025.                OTHER.4 = '-q = enable ANSI support for comments'
  1026.                OTHER.5 = '-s = password ....'
  1027.                OTHER.6 = '     attributes ....'
  1028.                OTHER.7 = '     troubleshooting and compatibility options ....   '
  1029.             end
  1030.             call vcheckbox 'Further Options:', OTHER, PAR2, 1
  1031.             drop OTHER.
  1032.             do p = 1 to PAR2.0
  1033.                if left(PAR2.p,1) = '-' then PAR2.p = left(PAR2.p,2)
  1034.                else do
  1035.                   if substr(PAR2.p,6,1) = 'a' then PAR2.p = 'attributes'
  1036.                   if substr(PAR2.p,6,1) = 't' then PAR2.p = 'trouble'
  1037.                end
  1038.             end
  1039.             do q = 1 to PAR2.0
  1040.                select
  1041.                   when PAR2.q = '-@' then do
  1042.                      OPTIONS = strip(OPTIONS ZipView.CMD('List'))
  1043.                      call WinBox
  1044.                   end
  1045.                   when PAR2.q = '-!' then do
  1046.                      OPTIONS = strip(OPTIONS PAR2.q)
  1047.                      call WinBox
  1048.                   end
  1049.                   when PAR2.q = '-$' then do
  1050.                      drop MSG.
  1051.                      MSG.0 = 2
  1052.                      MSG.1 = 'Type the letter for the drive whose volume label   '
  1053.                      MSG.2 = 'you want to include in the .ZIP file:   '
  1054.                      do until (BUTTON = 'CANCEL')|(datatype(left(MSG.VSTRING,1),'M') = 1)
  1055.                         BUTTON = vinputbox('Drive Letter:', MSG, 3, 3)
  1056.                      end
  1057.                      if BUTTON = 'OK' then OPTIONS = strip(OPTIONS '-$'left(MSG.VSTRING,1))
  1058.                      drop BUTTON MSG.
  1059.                      call WinBox
  1060.                   end
  1061.                   when PAR2.q = 'trouble' then do
  1062.                      TRBL.0 = 2
  1063.                      TRBL.1 = '-^ = echo the command line before executing      '
  1064.                      TRBL.2 = '-3 = disable 32-bit instructions (386 or up)     '
  1065.                      if VER = 2 then do
  1066.                         TRBL.0 = 8
  1067.                         TRBL.3 = '-+ = disable EMS usage'
  1068.                         TRBL.4 = '-- = disable XMS/UMB usage'
  1069.                         TRBL.5 = '-) = disable DPMI usage'
  1070.                         TRBL.6 = '-( = disable RAM cache usage (486 or up)   '
  1071.                         TRBL.7 = '-~ = disable Network detection'
  1072.                         TRBL.8 = '-= = ignore Share and other file lockers   '
  1073.                      end
  1074.                      call vcheckbox 'Troubleshooting Options:', TRBL, TRBL2, 1
  1075.                      do x = 1 to TRBL2.0
  1076.                         OPTIONS = strip(OPTIONS left(TRBL2.x,2))
  1077.                      end
  1078.                      call WinBox
  1079.                      drop TRBL. TRBL2.
  1080.                   end
  1081.                   when PAR2.q = '-e' then do
  1082.                      COMPR.0 = 5
  1083.                      if VER = 1 then do
  1084.                         COMPR.1 = 'a = Implode ASCII files, Shrink Binary files    '
  1085.                         COMPR.2 = 'b = Implode Binary files, Shrink ASCII files'
  1086.                         COMPR.3 = 'i = Implode only'
  1087.                         COMPR.4 = 's = Shrink all'
  1088.                         COMPR.5 = 'x = Implode all (default)'
  1089.                         COMPR.VSTRING = COMPR.5
  1090.                      end
  1091.                      if VER = 2 then do
  1092.                         COMPR.1 = '0 = Store all (no compression)   '
  1093.                         COMPR.2 = 'f = Fast'
  1094.                         COMPR.3 = 'n = Default'
  1095.                         COMPR.4 = 's = Super Fast'
  1096.                         COMPR.5 = 'x = Smallest'
  1097.                         COMPR.VSTRING = COMPR.3
  1098.                      end
  1099.                      call vradiobox 'Which Compression Method?', COMPR, 1
  1100.                      OPTIONS = strip(OPTIONS '-e'left(COMPR.VSTRING,1))
  1101.                      drop COMPR.
  1102.                      call WinBox
  1103.                   end
  1104.                   when PAR2.q = '-q' then do
  1105.                      OPTIONS = strip(OPTIONS PAR2.q)
  1106.                      call WinBox
  1107.                   end
  1108.                   when PAR2.q = '-s' then do
  1109.                      if DIRNAME = '-x*.*' then do
  1110.                         MSG.0 = 5
  1111.                         call linein TEXT,1
  1112.                         do 253
  1113.                            call linein TEXT
  1114.                         end
  1115.                         do y = 1 to 5
  1116.                            MSG.y = linein(TEXT)
  1117.                         end
  1118.                         call vmsgbox 'Sorry!', MSG, 1
  1119.                         drop MSG.
  1120.                         PAR2.q = ''
  1121.                      end
  1122.                      else do
  1123.                         call Password
  1124.                         if PS<>'PS' then PAR2.q = PS
  1125.                         else PAR2.q = ''
  1126.                         drop PS
  1127.                      end
  1128.                      OPTIONS = strip(OPTIONS PAR2.q)
  1129.                      call WinBox
  1130.                   end
  1131.                   when PAR2.q = 'attributes' then do
  1132.                      PAR2.q = ''
  1133.                      drop ATT1. ATT.
  1134.                      ATT.0 = 2
  1135.                      ATT.1 = '-j = do not give attributes to the compressed files ....   '
  1136.                      ATT.2 = '-w = compress files that have H/S attributes ....  '
  1137.                      BUTTON = vcheckbox('Attributes', ATT, ATT1, 3)
  1138.                      if BUTTON = 'OK' then do
  1139.                         do s = 1 to ATT1.0
  1140.                            ATT1.s = left(ATT1.s,2)
  1141.                         end
  1142.                         do s = 1 to ATT1.0
  1143.                            drop U3.
  1144.                            if ATT1.s = '-j' then MASK.0 = 3
  1145.                            if ATT1.s = '-w' then MASK.0 = 2
  1146.                            MASK.1 = 'Hidden'
  1147.                            MASK.2 = 'System'
  1148.                            if ATT1.s = '-j' then MASK.3 = 'Read-only'
  1149.                            if ATT1.s = '-j' then BUT = vcheckbox('Which to Mask?', MASK, U3, 3)
  1150.                            if ATT1.s = '-w' then BUT = vcheckbox('Which to Compress?', MASK, U3, 3)
  1151.                            if BUT = 'OK' then do k = 1 to U3.0
  1152.                               ATT1.s = ATT1.s||left(U3.k,1)
  1153.                            end
  1154.                            if length(ATT1.s) = 2 then ATT1.s = ''
  1155.                            PAR2.q = strip(PAR2.q ATT1.s)
  1156.                         end
  1157.                      end
  1158.                      drop BUTTON ATT1. MASK. ATT. U3.
  1159.                      OPTIONS = strip(OPTIONS PAR2.q)
  1160.                      call WinBox
  1161.                   end
  1162.                   otherwise nop
  1163.                end
  1164.             end
  1165.          end
  1166.          otherwise nop
  1167.       end
  1168.    end
  1169.    drop PAR. PAR2.
  1170. return
  1171. UnzOpt:
  1172.    OPTIONS = strip(AOP UOP)
  1173.    if OPTIONS<>'' then call WinBox
  1174.    drop PAR.
  1175.    ULIST1.1 = '-$ = extract volume label'
  1176.    ULIST1.2 = '-d = create directories'
  1177.    ULIST1.3 = '-e = extract files in a certain order ....'
  1178.    ULIST1.4 = "-J = keep attributes of the extracted files .... "
  1179.    ULIST1.6 = '-s = unscramble with password ....'
  1180.    if VER = 1 then do
  1181.       ULIST1.0 = 9
  1182.       ULIST1.5 = '-o = overwrite existing files'
  1183.       ULIST1.7 = '     extract only newer files ....'
  1184.       ULIST1.8 = '     extract only specified filenames ....'
  1185.       ULIST1.9 = '     further options ....'
  1186.    end
  1187.    if VER = 2 then do
  1188.       ULIST1.0 = 10
  1189.       ULIST1.5 = '-o = extract without prompting for overwrite ....'
  1190.       ULIST1.7 = '-x = exclude certain files ....'
  1191.       ULIST1.8 = '     extract only newer files ....'
  1192.       ULIST1.9 = '     extract only specified filenames ....'
  1193.       ULIST1.10 = '     further options ....'
  1194.    end
  1195.    BUTTON = vcheckbox('Unzip Special OPTIONAL Switches:', ULIST1, PAR, 3)
  1196.    if BUTTON = 'CANCEL' then do
  1197.       call vclosewindow WINDOW
  1198.       signal Main
  1199.    end
  1200.    drop BUTTON
  1201.    do i = 1 to PAR.0
  1202.       if left(PAR.i,1) = '-' then PAR.i = left(PAR.i,2)
  1203.       else select
  1204.          when (substr(PAR.i,6,1) = 'e')&(substr(PAR.i,19,1) = 'n') then PAR.i = 'newer'
  1205.          when substr(PAR.i,6,1) = 'e' then PAR.i = 'specified'
  1206.          when substr(PAR.i,6,1) = 'f' then PAR.i = 'further'
  1207.          otherwise nop
  1208.       end
  1209.    end
  1210.    drop ULIST1.
  1211.    do i = 1 to PAR.0
  1212.       select
  1213.          when PAR.i = '-x' then do
  1214.             PAR.i = ''
  1215.             drop FILES.
  1216.             if EXT = 'BAT' then FILES.0 = 10
  1217.             if EXT = 'CMD' then FILES.0 = 7
  1218.             call linein TEXT,1
  1219.             do 96
  1220.                call linein TEXT
  1221.             end
  1222.             do y = 1 to FILES.0
  1223.                FILES.y = linein(TEXT)
  1224.             end
  1225.             BUTEX = vinputbox("Files to Exclude from Extraction:", FILES, 40, 3)
  1226.             if BUTEX = 'CANCEL' then do
  1227.                OPER = 'exclude'
  1228.                call View
  1229.                if DISKFILES = 'DISKFILES' then DISKFILES = ''
  1230.                FILES.VSTRING = DISKFILES
  1231.                drop OPER DISKFILES VAR. MSG. NUMBER
  1232.             end
  1233.             do t = 1 while FILES.VSTRING<>''
  1234.                select
  1235.                   when left(FILES.VSTRING,1) = '"' then do
  1236.                      parse var FILES.VSTRING . '"' NAME.t '"' FILES.VSTRING
  1237.                      NAME.t = '"'||NAME.t||'"'
  1238.                   end
  1239.                   when left(FILES.VSTRING,1) = "'" then do
  1240.                      parse var FILES.VSTRING . "'" NAME.t "'" FILES.VSTRING
  1241.                      NAME.t = "'"||NAME.t||"'"
  1242.                   end
  1243.                   otherwise parse var FILES.VSTRING NAME.t FILES.VSTRING
  1244.                end
  1245.                FILES.VSTRING = strip(FILES.VSTRING)
  1246.                NAME.0 = t
  1247.             end
  1248.             if symbol('NAME.0') = 'VAR' then do t = 1 to NAME.0
  1249.                PAR.i = strip(PAR.i '-x'||NAME.t)
  1250.             end
  1251.             OPTIONS = strip(OPTIONS PAR.i)
  1252.             drop FILES. BUTEX NAME.
  1253.             call WinBox
  1254.          end
  1255.          when PAR.i = '-$' then do
  1256.             MSG.0 = 3
  1257.             call linein TEXT,1
  1258.             do 107
  1259.                call linein TEXT
  1260.             end
  1261.             do y = 1 to 3
  1262.                MSG.y = linein(TEXT)
  1263.             end
  1264.             BUTTON = vmsgbox("Really?", MSG, 6)
  1265.             if BUTTON = 'YES' then OPTIONS = strip(OPTIONS PAR.i)
  1266.             drop BUTTON MSG.
  1267.             call WinBox
  1268.          end
  1269.          when PAR.i = '-d' then do
  1270.             OPTIONS = strip(OPTIONS PAR.i)
  1271.             call WinBox
  1272.          end
  1273.          when PAR.i = '-e' then do
  1274.             ORDER.0 = 6
  1275.             ORDER.1 = 'c = CRC'
  1276.             ORDER.2 = 'd = date'
  1277.             ORDER.3 = 'e = extension'
  1278.             ORDER.4 = 'n = name'
  1279.             ORDER.5 = 'p = percentage'
  1280.             ORDER.6 = 's = size'
  1281.             ORDER.VSTRING = ORDER.4
  1282.             if VER = 2 then do
  1283.                ORDER.0 = 12
  1284.                ORDER.7 = 'cr = CRC reverse'
  1285.                ORDER.8 = 'dr = date reverse'
  1286.                ORDER.9 = 'er = extension reverse'
  1287.                ORDER.10 = 'nr = name reverse'
  1288.                ORDER.11 = 'pr = percentage reverse'
  1289.                ORDER.12 = 'sr = size reverse'
  1290.                call vlistbox "What order?", ORDER, 25, 9, 1
  1291.             end
  1292.             else call vradiobox 'What order?', ORDER, 1
  1293.             OPTIONS = strip(OPTIONS '-e'left(ORDER.VSTRING,2))
  1294.             drop ORDER.
  1295.             call WinBox
  1296.          end
  1297.          when PAR.i = '-J' then do
  1298.             drop U3.
  1299.             MASK.0 = 3
  1300.             MASK.1 = 'Hidden'
  1301.             MASK.2 = 'System'
  1302.             MASK.3 = 'Read-only'
  1303.             BUTTON = vcheckbox('Which Attributes?', MASK, U3, 3)
  1304.             if BUTTON = 'OK' then do k = 1 to U3.0
  1305.                PAR.i = PAR.i||left(U3.k,1)
  1306.             end
  1307.             if length(PAR.i) = 2 then PAR.i = ''
  1308.             drop BUTTON MASK. U3.
  1309.             OPTIONS = strip(OPTIONS PAR.i)
  1310.             call WinBox
  1311.          end
  1312.          when PAR.i = '-o' then do
  1313.             if VER = 2 then do
  1314.                NEWO.0 = 2
  1315.                NEWO.1 = '-o = overwrite any matching files    '
  1316.                NEWO.2 = '-o-= do not overwrite any files '
  1317.                call vradiobox 'Overwrite or not?', NEWO, 1
  1318.                if NEWO.VSTRING = NEWO.2 then PAR.i = '-o-'
  1319.                drop NEWO.
  1320.             end
  1321.             OPTIONS = strip(OPTIONS PAR.i)
  1322.             call WinBox
  1323.          end
  1324.          when PAR.i = '-s' then do
  1325.             call Password
  1326.             if PS<>'PS' then PAR.i = PS
  1327.             else PAR.i = ''
  1328.             drop PS
  1329.             OPTIONS = strip(OPTIONS PAR.i)
  1330.             call WinBox
  1331.          end
  1332.          when PAR.i = 'newer' then do
  1333.             WHICH.0 = 2
  1334.             WHICH.1 = 'Newer Files Only'
  1335.             WHICH.2 = 'Newer Existing Files Only      '
  1336.             WHICH.VSTRING = WHICH.1
  1337.             call vradiobox 'Specify:', WHICH, 1
  1338.             if WHICH.VSTRING = WHICH.2 then OPTIONS = strip(OPTIONS '-f')
  1339.             else OPTIONS = strip(OPTIONS '-n')
  1340.             drop WHICH.
  1341.             call WinBox
  1342.          end
  1343.          when PAR.i = 'specified' then do
  1344.             drop FILES.
  1345.             if EXT = 'BAT' then FILES.0 = 10
  1346.             if EXT = 'CMD' then FILES.0 = 7
  1347.             call linein TEXT,1
  1348.             do 111
  1349.                call linein TEXT
  1350.             end
  1351.             do y = 1 to FILES.0
  1352.                FILES.y = linein(TEXT)
  1353.             end
  1354.             BUTTON = vinputbox("Files to Extract from the .ZIP File:", FILES, 40, 3)
  1355.             drop DISKFILES
  1356.             if BUTTON = 'CANCEL' then do
  1357.                OPER = 'extract'
  1358.                call View
  1359.             end
  1360.             drop BUTTON VAR. MSG. NUMBER
  1361.             if FILES.VSTRING = 'FILES.VSTRING' then FILES.VSTRING = ''
  1362.             if DISKFILES = 'DISKFILES' then DISKFILES = ''
  1363.             FILENAMES = strip(DISKFILES FILES.VSTRING)
  1364.             drop DISKFILES FILES.
  1365.             call WinBox
  1366.          end
  1367.          when PAR.i = 'further' then do
  1368.             drop PAR2.
  1369.             if VER = 2 then do
  1370.                OTHER.0 = 5
  1371.                OTHER.1 = "-@ = generate list file instead of unzipping ....  "
  1372.                OTHER.2 = "-c = extract to screen ...."
  1373.                OTHER.3 = "-p = extract to printer ...."
  1374.                OTHER.4 = "-q = enable ANSI support for comments"
  1375.                OTHER.5 = '     troubleshooting and compatibility options ....'
  1376.             end
  1377.             if VER = 1 then do
  1378.                OTHER.0 = 4
  1379.                OTHER.1 = "-c = extract to screen ...."
  1380.                OTHER.2 = "-p = extract to printer ...."
  1381.                OTHER.3 = "-q = enable ANSI support for comments"
  1382.                OTHER.4 = '     troubleshooting and compatibility options ....  '
  1383.             end
  1384.             call vcheckbox 'Additional Options:', OTHER, PAR2, 1
  1385.             drop OTHER.
  1386.             do p = 1 to PAR2.0
  1387.                if left(PAR2.p,1) = '-' then PAR2.p = left(PAR2.p,2)
  1388.                else PAR2.p = 'trouble'
  1389.             end
  1390.             do q = 1 to PAR2.0
  1391.                select
  1392.                   when PAR2.q = '-@' then do
  1393.                      OPTIONS = strip(OPTIONS ZipView.CMD('List'))
  1394.                      call WinBox
  1395.                   end
  1396.                   when PAR2.q = 'trouble' then do
  1397.                      TRBL.0 = 2
  1398.                      TRBL.1 = '-^ = echo the command line before executing      '
  1399.                      TRBL.2 = '-3 = disable 32-bit instructions (386 or up)     '
  1400.                      if VER = 2 then do
  1401.                         TRBL.0 = 5
  1402.                         TRBL.3 = '-+ = disable EMS usage'
  1403.                         TRBL.4 = '-- = disable XMS/UMB usage'
  1404.                         TRBL.5 = '-) = disable DPMI usage'
  1405.                      end
  1406.                      call vcheckbox 'Troubleshooting Options:', TRBL, TRBL2, 1
  1407.                      do x = 1 to TRBL2.0
  1408.                         OPTIONS = strip(OPTIONS left(TRBL2.x,2))
  1409.                      end
  1410.                      call WinBox
  1411.                      drop TRBL. TRBL2.
  1412.                   end
  1413.                   when PAR2.q = '-c' then do
  1414.                      call ZipView.CMD 'Sure -c' OPTIONS
  1415.                      parse var RESULT PAR2.q '/' OPTIONS
  1416.                      if PAR2.q = '-c' then do
  1417.                         DONT = 'NO'
  1418.                         PEE = wordpos('-p',PAR2.1 PAR2.2 PAR2.3 PAR2.4 PAR2.5)
  1419.                         if PEE>0 then PAR2.PEE = ' '
  1420.                         drop PEE
  1421.                         PAUSE.0 = 2
  1422.                         PAUSE.1 = 'pause on each screen'
  1423.                         PAUSE.2 = 'no pause'
  1424.                         PAUSE.VSTRING = PAUSE.1
  1425.                         call vradiobox 'Pause?', PAUSE, 1
  1426.                         if PAUSE.VSTRING = PAUSE.1 then PAR2.q = '-cm'
  1427.                         drop PAUSE.
  1428.                         OPTIONS = strip(OPTIONS PAR2.q)
  1429.                      end
  1430.                      call WinBox
  1431.                   end
  1432.                   when PAR2.q = '-p' then do
  1433.                      call ZipView.CMD 'Sure -p' OPTIONS
  1434.                      parse var RESULT PAR2.q '/' OPTIONS
  1435.                      if PAR2.q = '-p' then do
  1436.                         DONT = 'NO'
  1437.                         PRINT.0 = 6
  1438.                         PRINT.1 = 'a = ASCII mode (and form feed)'
  1439.                         PRINT.2 = 'b = Binary mode (and no form feed)'
  1440.                         PRINT.3 = '  Do NOT choose more than one of the above!       '
  1441.                         PRINT.4 = ' '
  1442.                         PRINT.5 = 'c = COM port instead of LPT port'
  1443.                         PRINT.6 = '# = Port number if not 1 ....'
  1444.                         call vcheckbox 'Optional:', PRINT, UA, 1
  1445.                         do n = 1 to UA.0
  1446.                            select
  1447.                               when left(UA.n,1) = 'a' then PAR2.q = PAR2.q'a'
  1448.                               when left(UA.n,1) = 'b' then PAR2.q = PAR2.q'b'
  1449.                               when left(UA.n,1) = 'c' then PAR2.q = PAR2.q'c'
  1450.                               when left(UA.n,1) = '#' then do
  1451.                                  PORT.0 = 3
  1452.                                  PORT.1 = '2'
  1453.                                  PORT.2 = '3'
  1454.                                  PORT.3 = '4'
  1455.                                  PORT.VSTRING = PORT.1
  1456.                                  call vradiobox 'Select Port Number:', PORT, 1
  1457.                                  PAR2.q = PAR2.q||PORT.VSTRING
  1458.                                  drop PORT.
  1459.                               end
  1460.                               otherwise nop
  1461.                            end
  1462.                         end
  1463.                         OPTIONS = strip(OPTIONS PAR2.q)
  1464.                         call WinBox
  1465.                         MSG.0 = 1
  1466.                         MSG.1 = 'Turn the printer on and make sure it has paper!'
  1467.                         call vmsgbox "Notice:", MSG, 1
  1468.                         drop MSG. PRINT. UA.
  1469.                      end
  1470.                      else call WinBox
  1471.                   end
  1472.                   when PAR2.q = '-q' then do
  1473.                      OPTIONS = strip(OPTIONS PAR2.q)
  1474.                      call WinBox
  1475.                   end
  1476.                   otherwise nop
  1477.                end
  1478.             end
  1479.          end
  1480.          otherwise nop
  1481.       end
  1482.    end
  1483.    drop PAR. PAR2.
  1484. return
  1485. Temp:
  1486.    drop DIR.
  1487.    DIR.0 = 9
  1488.    call linein TEXT,1
  1489.    do 126
  1490.       call linein TEXT
  1491.    end
  1492.    do y = 1 to 9
  1493.       if (y = 4)|(y = 7) then DIR.y = ''
  1494.       else DIR.y = linein(TEXT)
  1495.    end
  1496.    if TEMPOLD<>'' then DIR.VSTRING = TEMPOLD
  1497.    call vinputbox 'OPTIONAL Temporary directory:', DIR, 40, 1
  1498.    TEMPOLD = Validate(DIR.VSTRING)
  1499.    if TEMPOLD = 'NO WAY' then do
  1500.       TEMPOLD = DIR.VSTRING
  1501.       call Temp
  1502.       return
  1503.    end
  1504.    drop DIR.
  1505. return
  1506. DiskFiles:
  1507.    DISKFILES = ''
  1508.    drop VAR. NUMBER MSG. BUTTON
  1509.    call sysfiletree DIRNAME2'*.*', 'VAR', 'OF'
  1510.    SubDiskFiles:
  1511.    if BUTTON = 'CANCEL' then return
  1512.    if NUMBER = 'NUMBER' then NUMBER = 0
  1513.    do a = NUMBER+1 to NUMBER+10
  1514.       if VAR.a = 'VAR.'a then VAR.a = ' '
  1515.    end
  1516.    if value('VAR.'NUMBER+1) = ' ' then return
  1517.    MSG.0 = 10
  1518.    NEWNUM = NUMBER
  1519.    do y = 1 to 10
  1520.       NEWNUM = NEWNUM+1
  1521.       MSG.y = value('VAR.'NEWNUM)'                  '
  1522.    end
  1523.    NUMBER = NUMBER+10
  1524.    DATA = ACTION'files'NUMBER'.0'
  1525.    interpret DATA "= 0"
  1526.    drop DATA NEWNUM
  1527.    BUTTON = vcheckbox("Choose the files to" ACTION':', MSG, value(ACTION'files'||NUMBER), 3)
  1528.    if BUTTON = 'OK' then do e = 1 to value(ACTION'files'||NUMBER'.0')
  1529.       DISKFILES = strip(DISKFILES value(ACTION'files'||NUMBER'.'e))
  1530.    end
  1531.    call SubDiskFiles
  1532.    if DISKFILES = '' then drop DISKFILES
  1533.    DATA = ACTION'files'||NUMBER'.'
  1534.    drop MSG. value(DATA) DATA BUTTON VAR.
  1535. return
  1536. View:
  1537.    AB123 = EXECUTABLE ; AB456 = OPTIONS ; DISKFILES = '' ; EXECUTABLE = ZIP ; OPTIONS = strip(AOP '-v')
  1538.    call Order
  1539.    if (SOURCE = '')&((OPER = 'extract')|(OPER = 'exclude')) then call Source
  1540.    if OPER = 'delete' then do
  1541.       POS.left = 37 ; POS.right = 63 ; POS.top = 50 ; POS.bottom = 35
  1542.       WINDOW = vopenwindow('Zip Engine', BG, POS)
  1543.       call vsetfont WINDOW, 'SYSTEM', 10
  1544.       call vforecolor WINDOW, FG
  1545.       drop POS.
  1546.       WINORG = WINDOW
  1547.       call vsay WINDOW, 150, 500, 'Working.....'
  1548.       call vsay WINDOW, 150, 300, 'Please wait.....'
  1549.    end
  1550.    else do
  1551.       call vclearwindow WINDOW
  1552.       call vsay WINDOW, 200, 400, 'Working.....Please Wait........'
  1553.    end
  1554.    if right(TEMPOLD,1)='\' then do
  1555.       TEMPBFILE = systempfilename(TEMPOLD'1?????.'EXT)
  1556.       TEMPBFILE2 = systempfilename(TEMPOLD'2?????.tmp')
  1557.    end
  1558.    else do
  1559.       TEMPBFILE = systempfilename(TEMPOLD'\1?????.'EXT)
  1560.       TEMPBFILE2 = systempfilename(TEMPOLD'\2?????.tmp')
  1561.    end
  1562.    call lineout TEMPBFILE,'@ECHO OFF'
  1563.    call lineout TEMPBFILE2
  1564.    if RESULT = 1 then do
  1565.       call vclosewindow WINDOW
  1566.       call CreateError
  1567.    end
  1568.    call lineout TEMPBFILE,EXECUTABLE OPTIONS SOURCE " >> " TEMPBFILE2
  1569.    call lineout TEMPBFILE,"ATTRIB -R" TEMPBFILE
  1570.    call lineout TEMPBFILE,"REM If Zip Engine isn't running at this moment, delete this file."
  1571.    call lineout TEMPBFILE
  1572.    'ATTRIB +R' TEMPBFILE
  1573.    'start /b /c' TEMPBFILE
  1574.    do until rc = 0
  1575.       rc = sysfiledelete(TEMPBFILE)
  1576.       if rc<>0 then call syssleep 1
  1577.    end
  1578.    drop THATNUM MSG. VAR. NUMBER TEMPBFILE BUTTON
  1579.    do until word(THISLINE,1) = 'Length'
  1580.       if \ lines(TEMPBFILE2) then do
  1581.          MSG.0 = 3
  1582.          MSG.1 = 'A strange occurrence......there are no'
  1583.          MSG.2 = 'files inside this .ZIP file.  Returning'
  1584.          MSG.3 = 'you to the main menu now.'
  1585.          call vmsgbox 'Sorry!', MSG, 1
  1586.          if OPER = 'delete' then do
  1587.             call vclosewindow WINDOW
  1588.             drop WINORG
  1589.          end
  1590.          call lineout TEMPBFILE2
  1591.          call sysfiledelete TEMPBFILE2
  1592.          signal Main
  1593.       end
  1594.       THISLINE = linein(TEMPBFILE2)
  1595.    end
  1596.    call linein TEMPBFILE2
  1597.    if THATNUM = 'THATNUM' then THATNUM = 1
  1598.    do while lines(TEMPBFILE2) = 1
  1599.       VAR.THATNUM = substr(linein(TEMPBFILE2),62)
  1600.       THATNUM = THATNUM+1
  1601.    end
  1602.    call lineout TEMPBFILE2
  1603.    call sysfiledelete TEMPBFILE2
  1604.    VAR.0 = THATNUM-3
  1605.    call vclearwindow WINDOW
  1606.    call SubView
  1607.    EXECUTABLE = AB123 ; OPTIONS = AB456
  1608.    drop AB123 AB456 VAR. MSG. TEMPBFILE2 THISLINE THATNUM
  1609.    if (OPER = 'extract')|(OPER = 'exclude') then READY = 'YES'
  1610.    DATA = OPER'files'||NUMBER'.'
  1611.    drop value(DATA) DATA
  1612.    if OPER = 'delete' then do
  1613.       call vclosewindow WINDOW
  1614.       drop WINORG
  1615.    end
  1616. return
  1617. SubView:
  1618.    if BUTTON = 'CANCEL' then return
  1619.    if NUMBER = 'NUMBER' then NUMBER = 0
  1620.    do a = NUMBER+1 to NUMBER+10
  1621.       if a>VAR.0 then VAR.a = ' '
  1622.    end
  1623.    if value('VAR.'NUMBER+1) = ' ' then return
  1624.    MSG.0 = 10
  1625.    NEWNUM = NUMBER
  1626.    do y = 1 to 10
  1627.       NEWNUM = NEWNUM+1
  1628.       MSG.y = value('VAR.'NEWNUM)'                  '
  1629.    end
  1630.    NUMBER = NUMBER+10
  1631.    DATA = OPER'files'NUMBER'.0'
  1632.    interpret DATA "= 0"
  1633.    drop DATA NEWNUM
  1634.    BUTTON = vcheckbox("Choose the files to" OPER':', MSG, value(OPER'files'||NUMBER), 3)
  1635.    if BUTTON = 'OK' then do e = 1 to value(OPER'files'||NUMBER'.0')
  1636.       DISKFILES = strip(DISKFILES value(OPER'files'||NUMBER'.'e))
  1637.    end
  1638.    call SubView
  1639.    if DISKFILES = '' then drop DISKFILES
  1640. return
  1641. ViewOnly:
  1642.    if wordpos('-s',OPTIONS)>0 then do
  1643.       POS.left = 2 ; POS.right = 98 ; POS.top = 25 ; POS.bottom = 10
  1644.       WINDOW = vopenwindow('(Zip Engine) Working.....', BG, POS)
  1645.       call vsetfont WINDOW, 'SYSTEM', 10
  1646.       call vforecolor WINDOW, FG
  1647.       call linein TEXT,1
  1648.       do 270
  1649.          call linein TEXT
  1650.       end
  1651.       do k = 700 to 100 by -200
  1652.          call vsay WINDOW, 5, k, linein(TEXT)
  1653.       end
  1654.    end
  1655.    else do
  1656.       POS.left = 35 ; POS.right = 65 ; POS.top = 50 ; POS.bottom = 35
  1657.       WINDOW = vopenwindow('Zip Engine', BG, POS)
  1658.       call vsetfont WINDOW, 'SYSTEM', 10
  1659.       call vforecolor WINDOW, FG
  1660.       call vsay WINDOW, 150, 500, 'Working.....'
  1661.       call vsay WINDOW, 150, 300, 'Please wait.....'
  1662.    end
  1663.    drop POS.
  1664.    WINORG = WINDOW
  1665.    drop THATNUM
  1666.    if right(TEMPOLD,1)='\' then do
  1667.       TEMPCFILE = systempfilename(TEMPOLD'1?????.'EXT)
  1668.       TEMPCFILE2 = systempfilename(TEMPOLD'2?????.tmp')
  1669.    end
  1670.    else do
  1671.       TEMPCFILE = systempfilename(TEMPOLD'\1?????.'EXT)
  1672.       TEMPCFILE2 = systempfilename(TEMPOLD'\2?????.tmp')
  1673.    end
  1674.    call lineout TEMPCFILE,'@ECHO OFF'
  1675.    call lineout TEMPCFILE2
  1676.    if RESULT = 1 then do
  1677.       call vclosewindow WINDOW
  1678.       call CreateError
  1679.    end
  1680.    call lineout TEMPCFILE,EXECUTABLE OPTIONS SOURCE " >> " TEMPCFILE2
  1681.    call lineout TEMPCFILE,'ATTRIB -R' TEMPCFILE
  1682.    call lineout TEMPCFILE,"echo If Zip Engine isn't running at this moment, delete this file."
  1683.    call lineout TEMPCFILE
  1684.    'ATTRIB +R' TEMPCFILE
  1685.    if wordpos('-s',OPTIONS)>0 then 'start /win /b /c' TEMPCFILE
  1686.    else 'start /b /c' TEMPCFILE
  1687.    do until rc = 0
  1688.       rc = sysfiledelete(TEMPCFILE)
  1689.       if rc<>0 then call syssleep 1
  1690.    end
  1691.    if wordpos('-s',OPTIONS)>0 then do
  1692.       POS.left = 35 ; POS.right = 65 ; POS.top = 50 ; POS.bottom = 35
  1693.       call vclearwindow WINDOW
  1694.       call vsettitle WINDOW, 'Zip Engine'
  1695.       call vresize WINDOW, POS
  1696.       call vsay WINDOW, 150, 500, 'Working.....'
  1697.       call vsay WINDOW, 150, 300, 'Please wait.....'
  1698.       drop POS.
  1699.    end
  1700.    drop MSG. TEMPCFILE
  1701.    if THATNUM = 'THATNUM' then THATNUM = 1
  1702.    do while lines(TEMPCFILE2) = 1
  1703.       MSG.THATNUM = left(linein(TEMPCFILE2),80)
  1704.       THATNUM = THATNUM+1
  1705.    end
  1706.    call lineout TEMPCFILE2
  1707.    MSG.0 = THATNUM-1
  1708.    call vlistbox "Here's what you wanted to see:", MSG, 100, 10, 1
  1709.    call sysfiledelete TEMPCFILE2
  1710.    drop MSG. TEMPCFILE2 THATNUM
  1711. return
  1712. CreateError:
  1713.    MSG.0 = 10
  1714.    call linein TEXT,1
  1715.    do 259
  1716.       call linein TEXT
  1717.    end
  1718.    do y = 1 to 10
  1719.       MSG.y = linein(TEXT)
  1720.    end
  1721.    call vmsgbox "Sorry!", MSG, 1
  1722.    signal Main
  1723. return
  1724. CantUse:
  1725.    MSG.0 = 3
  1726.    MSG.1 = 'You cannot use the' PAR.i 'switch when'
  1727.    if NEWZIP<>'yes' then MSG.2 = 'you modify an existing .ZIP file.'
  1728.    else MSG.2 = 'you create a new .ZIP file.'
  1729.    MSG.3 = 'Dropping the' PAR.i 'switch now.'
  1730.    call vmsgbox "Sorry!", MSG, 1
  1731.    PAR.i = ''
  1732.    drop MSG.
  1733. return
  1734.