home *** CD-ROM | disk | FTP | other *** search
/ Monster Media 1994 #1 / monster.zip / monster / MAXIMUS / CDCAR_13.ZIP / CDCAR.CMD < prev    next >
OS/2 REXX Batch file  |  1994-02-18  |  18KB  |  612 lines

  1. /*                         CD Carousel Door                                */               
  2. /*                              v1.3                                       */               
  3. /*                         by Bill Esposito                                */               
  4. /*                       The Cereal Port BBS                               */
  5. /*                            1:132/152                                    */
  6. /*                          (603)899-3335                                  */
  7. /*                                                                         */
  8. /*                         Magic name 'CDCAR'                              */
  9. /*                         for latest version                              */
  10. /*                                                                         */
  11. /* *********************************************************************** */
  12. /* DISCLAIMER:  This software is provided "AS IS" without any warranty of  */
  13. /* any kind, either expressed or implied.  USE IT AT YOUR OWN RISK.        */
  14. /*                                                                         */
  15. /* Copyright 1993 by Bill Esposito.  This program is SHAREWARE.    Please  */
  16. /* read the file SHAREWRE.TXT included in this archive.                    */
  17. /* *********************************************************************** */
  18. /*                      *****  CDCAR.CMD  *****                            */
  19. /* The CD Carousel Door program.                                           */
  20. /***************************************************************************/
  21. signal on HALT NAME menu
  22. Arg configdir ansi me user
  23. '@echo off'
  24. config=configdir''cdcar.cfg
  25. f=1
  26. do until lines(config)=0
  27.   param.f=linein(config)
  28.   f=f+1
  29. end
  30. ok=stream(config,c,'close')
  31. parse var param.1 disk junk
  32. parse var param.2 menutype junk
  33. parse var param.3 homedir junk
  34. parse var param.4 maxdir junk
  35. parse var param.5 download junk
  36. parse var param.6 fnum junk
  37. parse var param.7 type junk
  38. parse var param.8 marea junk
  39. parse var param.9 tnode junk
  40. parse var param.10 fnode junk
  41. parse var param.11 sysopfirst sysoplast junk
  42. parse var param.12 stype junk
  43. parse var param.13 smarea junk
  44. parse var param.15 defaultcd junk
  45. reqflag='0'
  46. if ansi=2 then ansi = 0
  47. parse var user first2 mid2 last2
  48. nmi='NO'
  49. if last2='' then do
  50.  nmi='YES'
  51.  first=first2
  52.  last=mid2
  53.  mid=''
  54. end
  55. if nmi='NO' then do
  56.  first=first2
  57.  mid=mid2
  58.  last=last2
  59. end  
  60. grn=''
  61. yel=''
  62. red=''
  63. blu=''
  64. cyan=''
  65. brt=''
  66. gry=')'
  67. lo=''
  68. if ansi=1 then do
  69.         grn=''
  70.         yel=''
  71.         red=''
  72.         blu=''
  73.         cyan=''
  74.         brt=''
  75.         gry=''
  76.         lo=''
  77. end
  78.  
  79.  
  80. call RxFuncAdd 'SysloadFuncs','RexxUtil','Sysloadfuncs'
  81. call sysloadfuncs
  82. ver='v1.3'
  83. menu:
  84. signal on HALT NAME menu
  85.  if ansi=1 then if menutype=0 then do
  86.  
  87. say 'HOS/2OS/2OS/2OS/2OS/2'     
  88. say '1HOS/2OS/2OS/2OS/2OS/2OS/2OS'
  89. say '7H/2OS/2OS/2OS/2OS/2OS/2OS/2OS'
  90. say '5H/2OS/2HS   0HOH/H'      
  91. say '0HCD Carousel Door0HSH25H'ver'0H/'  
  92. say 'HO0HBy Bill Esposito0H2HS9H**' 
  93. say '2HUNREGISTERED5H**0HOH/1H'
  94. say '1H 4H    9H                    0HSH2' 
  95. say '1HThe Selected CD is: 'disk'     0H/HO'    
  96. say '9H                 0H21HS3H'          
  97. say '11H                   Change CD40H  80HO'  
  98. say '1H/80HS1H228H  File Area Selec'
  99. say '45Ht       80H/1HO80H21HS'  
  100. say '28H  Search by Filename/Text80HO1H/80HS'   
  101. say '1H228H  Bulletins               65H  '
  102. say '80H/1HO80H21HS26H' 
  103. say '27H   ?Help            63H  80HO'
  104. say '1H/80HS1H230HQuit back to BBS'      
  105. say '80H/1HO31H         80H21HS'  
  106. say '28H              80HO1H/2OS/2O'
  107. say '8HS/2OS/2OS/2OS/2OS/2OS/2OS/2'      
  108. say '35HOS/2OS/2OS/2OS/2OS/2OS/2'   
  109. say '59HOS/2OS/2OS/2OS/2OS/2OS'        
  110. say '1H'                                                                  
  111.  end
  112.   
  113.   if ansi='0' then if menutype=0 then do
  114.         '@cls'
  115.         say 'OS/2OS/2OS/2OS/2OS/2OS/2OS/2OS/2OS/2OS/2OS/2OS/2OS/2OS/2OS/2OS/2OS/2OS/2OS/2'
  116.         say                                                            
  117.         say '                             CD Carousel Door '
  118.         say '                                  'ver       
  119.         say '                             By Bill Esposito'
  120.         say '                             * Unregistered *'
  121.         say 
  122.         say '  The Currently Selected CD is: 'disk
  123.         say 
  124.         say '                             C)hange Disk'
  125.         say                               
  126.         say '                             F)ile Area   ' 
  127.         say 
  128.         say '                             S)earch by Filename/Text'
  129.         say 
  130.         say '                             B)ulletins '
  131.         say
  132.         say '                             ?)Help' 
  133.         say                             
  134.         say '                             Q)uit Back to BBS'
  135.         say 
  136.         say 'OS/2OS/2OS/2OS/2OS/2OS/2OS/2OS/2OS/2OS/2OS/2OS/2OS/2OS/2OS/2OS/2OS/2OS/2OS/2'
  137.   end   
  138.  
  139. if menutype=1 then do
  140.   say
  141.   say brt||yel'  CD Carousel Door: 'red||disk
  142.   say
  143.   say brt||yel||'C'gry'hange disk          'brt||yel'F'gry'ile area Select    'brt||yel'S'gry'earch by Filename/Text'    
  144.   say brt||yel'B'gry'ulletins            'brt||yel'Q'gry'uit to main        'brt||yel'?'gry'Help' 
  145. end
  146. pull sel
  147. if sel = 'B' then call bull
  148. if sel = '?' then call help
  149. if sel='C' then call change_disk
  150. if sel='C' then call menu
  151. if sel ='F'  then call filearealst
  152. if reqflag=1 then do
  153.   if sel = 'Q' then call quit
  154. end
  155.   if def=1 then if sel = 'Q' then call quit
  156.   if sel = 'Q' then call quit1
  157.   if sel ='S'  then call find
  158. signal menu
  159.  
  160. /* file area list */
  161. filearealst:
  162. close=stream(file,c,'close')
  163. more = 1
  164. file=homedir''disk'\names.lst'
  165. '@cls'
  166.  
  167. /* Read */
  168. read: 
  169. x=1
  170. y='1'
  171. open=stream(file,c,'open')
  172.  
  173. linein(file,1,0) 
  174.  
  175. loop2:
  176. if more <> 3 then '@cls'
  177. name.=0                        
  178. do i=1 to 20
  179.   xx=right(x,2)
  180.   if sel='F' then do
  181.     parse value linein(file) with name5 fuldir dirdesc
  182.     dirdesc=strip(dirdesc)
  183.     name.i=xx'.  'left(name5,10) dirdesc
  184.     fulldir.i=fuldir
  185.   end  
  186.  
  187.   if sel<>'F' then if sel <>'B' then if sel <>'?' then do
  188.      parse value linein(file) with disks diskdesc 
  189.      name.i= xx'.  'disks' 'strip(diskdesc)
  190.   end
  191.   if sel = 'B' then name.i = linein(file)
  192.   se=0
  193.   if more=3 then do
  194.   parse var name.i number nam diskdesc
  195.   name.i = right(number,3) nam diskdesc
  196. end  
  197.     if sel='F' then do
  198.       parse var name.i num name5 dirdesc
  199.     dirdesc=strip(dirdesc)
  200.       say brt||yel||right(num,3)||grn||left(name5,10) cyan||dirdesc
  201.     end
  202.     if sel <>'F' then if sel <> 'B' then if sel <> '?' then if sel <> 'C' then do
  203.       name.i=left(name.i,79)
  204.       parse var name.i num fn sz dt dc
  205.       say brt||red||right(num,3)||yel||left(fn,13)||red||right(sz,8)||grn||right(dt,9)'  'cyan||left(dc,44)
  206.     end
  207.     if sel = 'C' then do
  208.        name.i=left(name.i,79)
  209.        parse var name.i num disk6 diskdesc
  210.        say brt||red||right(num,3)||yel||left(disk6,13)||cyan||strip(diskdesc)
  211.     end
  212.  
  213.    if sel = 'B' then say brt||cyan||name.i
  214.   if more=0 then if lines(file)=''0'' then signal more
  215.   if more=1 then if lines(file)=''0'' then signal more
  216.   if more=2 then if lines(file)=''0'' then signal more
  217.     if more=3 then do
  218.       if lines(file)=''0'' then call more
  219.       if lines(file)=''0''then return
  220.     end
  221.   if lines(file)=''0'' then signal qdel
  222.   x=x+y
  223. end
  224. more:
  225.   x=1
  226.    say 
  227.    
  228.    if more=1 then do
  229.      if lines(file)<>0 then say 'More, Select file area? (Y,n,area#)'
  230.      if lines(file)=0 then say  'Select file area? (N,area#)'
  231.    end  
  232.    
  233.    if more=0 then do
  234.      say 'More? (Y,n)'
  235.    end
  236.    
  237.    if more=2 then do
  238.      if lines(file)<>0 then say 'More, File# ? (Y,n,#)'
  239.      if lines(file)=0 then say  'File# ? (N,#)'
  240.    end
  241.      
  242.    if more=3 then do
  243.      if lines(file)<>0 then say 'More, Select Disk? (Y,n,disk#)'
  244.      if lines(file)=0 then say  'Select Disk? (N,disk#)'
  245.    end
  246.      
  247.     pull yn
  248.     
  249.     if yn='N' then signal qdel
  250.     if more=2 then do
  251.       dt=datatype(yn)
  252.       if dt='NUM' then call tagger
  253.     end  
  254.     if yn='Y' then if fs=1 then return 
  255.     if yn='Y' then if fs <>1 then signal loop2
  256.        if yn='' then do 
  257.       if lines(file)=0 then signal qdel
  258.       signal loop2
  259.     end
  260.     dt= datatype(yn)
  261.     if dt='NUM' then if yn > i then yn=1
  262.     if more=1 then if dt='NUM' then call areasel
  263.     if more=3 then do
  264.       if dt<>'NUM' then yn=1
  265.       if dt='NUM' then return
  266.     end  
  267.     if lines(file)=''0'' then return
  268. if fs=1 then return
  269. signal loop2
  270. qdel:
  271. close=stream(file,c,'close')
  272. signal menu
  273.  
  274. more1:
  275. say 'more? (Y,n)'
  276. pull yn
  277. if yn="N" then signal menu
  278. count = 0
  279. return
  280.  
  281. tagger:
  282. tag=yn
  283. name3=name.tag
  284. parse var name3 num filename date time desc
  285. if filename <>'' then do
  286.    call sysfiletree homedir'*.req', 'file.', 'F'
  287.    if file.0=0 then firstime=1
  288.    parse upper var defaultcd dcd
  289.    parse upper var disk curcd
  290.      if dcd=curcd then do
  291.        call lineout homedir''disk'.def',nmi user fulldirectory filename desc
  292.        ok=stream(homedir''disk'.def',c,'close')
  293.        def=1
  294.      end
  295.    else do
  296.    call lineout homedir''disk'.req',nmi user fulldirectory filename desc
  297.     ok=stream(homedir''disk'.req',c,'close')
  298.     reqflag=1
  299.    end 
  300. end   
  301. call more
  302. return
  303.  
  304. areasel:
  305. name2=name.yn
  306. fulldirectory=fulldir.yn
  307. parse var name2 num areaname1 rest
  308. areaname=strip(areaname1)
  309. file=homedir''disk'\'areaname'.bbs'
  310. more=2
  311. sel=''
  312. call read
  313. return
  314.  
  315. change_disk:
  316. file=homedir'disk.lst'
  317. more=3
  318. call dmenu
  319. call read
  320. name4=name.yn
  321. parse var name4 num disk1 cdrom
  322. disk=strip(disk1)
  323. return
  324.  
  325. bull:
  326. more=0
  327. file=homedir'cdbull.txt'
  328. call read
  329. return
  330.  
  331. help:
  332. more=0
  333. file=homedir'cdhelp.txt'
  334. sel = 'B'
  335. call read
  336. return
  337.  
  338. dmenu:
  339.   if ansi=0 then do
  340.         '@cls'
  341.         say
  342.         say
  343.         say
  344.         say             
  345.         say '                             CD Carousel Door'
  346.         say '                                  'ver
  347.         say '                             By Bill Esposito'
  348.         say
  349.         say 
  350.         say '  The Currently Selected CD is: 'disk
  351.         say 
  352.         say
  353.   end
  354.   
  355.   if ansi=1 then do
  356.         '@cls'
  357.         say
  358.         say
  359.         say
  360.         say
  361.         say '                             CD Carousel Door'
  362.         say '                                  'ver
  363.         say '                             by Bill Esposito'
  364.         say
  365.         say '  '
  366.         say 'The Currently Selected CD is: 'disk
  367.         say ''
  368.         say
  369.   end
  370. return
  371. find:
  372. notfound=0
  373. more=4
  374. count=0
  375. i=0
  376. '@cls'
  377. say
  378. say
  379. say
  380. say
  381.  
  382. if ansi=1 then say 'Enter Filename or search string? (any text or numbers, no wildcards)'
  383. if ansi=0 then say 'Enter Filename or search string? (any text or numbers, NO WILDCARDS)'
  384. say
  385. pull what
  386. if what='' then signal menu
  387. file=homedir''disk'\names.lst'
  388. loop3:
  389. more=4
  390. fs=1
  391. z=1
  392. do until z=40
  393. linein(file,1,0) 
  394.  
  395. do until lines(file)=0
  396.   parse value linein(file) with drr fulldirectory dirdesc
  397.   drrr=homedir''disk'\'drr'.bbs'
  398.   file.=''
  399. areaname=drr
  400. say 'Directory: 'drr
  401.     ok=sysfilesearch(what, drrr, 'file.')
  402.  
  403. read1: 
  404. x=1
  405. y='1'
  406. name.0=0
  407.   do i=1 to file.0    
  408.   if file.i<>'' then do
  409.   xx=right(x,2)
  410.   name.i= xx'.  'file.i
  411.   if left(file.i,5) <>'FILE.' then do
  412.       name.i=left(name.i,79)
  413.       parse var name.i num fn sz dt dc
  414.       say brt||red||right(num,3)||yel||left(fn,13)||red||right(sz,8)||grn||right(dt,9)||cyan'  'dc
  415.   end
  416.   if left(file.i,5) <>'FILE.' then notfound=1
  417.   if datatype(i/20,'W')=1 then call tag
  418. end
  419. x=x+y
  420. end
  421. if file.0 <>0 then call tag
  422. z=z+y
  423. end
  424. if lines(file)<>0 then call loop3
  425. ok=stream(file,c,'close')
  426. if notfound=0 then do
  427.   say ' Sorry, unable to find 'WHAT
  428.   say ' Press <ENTER> to continue'
  429.   pull ent
  430. end  
  431.  
  432. signal menu
  433.  
  434. quit:
  435. file=homedir'disk.lst'
  436.   if ansi=0 then do
  437.         '@cls'
  438.         say
  439.         say '                           CD Carousel Door'
  440.         say
  441.         say  
  442.   end
  443.   
  444.   if ansi = 1 then do
  445.         '@cls'
  446.         say
  447.         say '                           CD Carousel Door'
  448.         say
  449.         say '
  450.   end
  451. if reqflag=1 then do
  452. say First','
  453. say '     You have requested the following files.  You will receive a'
  454. say 'message for each sucessfully filled file request.  Please K)ill'
  455. say 'these messages upon receipt.  When posted, your files can be found'
  456. say 'for download in File Area 'fnum'.'
  457. say
  458.    ok=stream(file,c,'close')
  459. do until lines(file)=0
  460.    parse value linein(file) with disk1 diskdesc
  461.    disk=homedir''disk1'.req'
  462.    ok=stream(disk,c,'close')
  463.    x=8
  464.    request=yes
  465.    dsk=no
  466.       do until lines(disk)=0
  467.          request=no
  468.          if nmi='NO' then do
  469.              parse value linein(disk) with nmi1 first1 mid1 last1 directory filename desc
  470.          end    
  471.          if nmi='YES' then do
  472.              parse value linein(disk) with nmi1 first1 last1 directory filename desc
  473.              mid1=mid
  474.          end    
  475.          if x=20 then say
  476.          if x=20 then say 'Press <ENTER> to continue'
  477.          if x=20 then pull ak         
  478.          if x=20 then x=8
  479.          if first1=first then if mid1=mid then if last1=last then do
  480.              if dsk=no then say
  481.              if dsk=no then say 'CD: 'disk1''
  482.              dsk=yes
  483.              say left(filename,12) desc
  484.              request=yes
  485.              req=yes
  486.          end    
  487.          x=x+1
  488.        end
  489.    end
  490. ok=stream(file,c,'close')
  491. say
  492. if def = 1 then say 'The files you selected from 'brt||red||defaultcd||lo||cyan' are available 'brt||red'now'lo' from File Area 'fnum'.'
  493. end
  494. if reqflag <> 1 then if def = 1 then do
  495. say first','
  496. say'    The files you selected from 'brt||red||defaultcd||lo||cyan' are available 'brt||red'now'lo' from File Area 'fnum'.' 
  497. end
  498. say
  499. say 'Press <ENTER> to continue'
  500. pull ak        
  501. call msg
  502. quit1:
  503. '@cls'
  504. file=homedir'disk.lst'
  505. do until lines(file)=0
  506.    parse value linein(file) with disk1 diskdesc
  507.    ok=stream(homedir''strip(disk1)'\names.lst',c,'close')
  508. end 
  509. ok=stream(file,c,'close')
  510. if def=1 then do
  511.   siz=length(homedir)
  512.   homedi=left(homedir,siz-1)
  513.   drive=left(homedir,2)
  514.   drive
  515.   '@cd' homedi
  516.   call cdmaint.cmd 0 1
  517. end
  518. if me=1 then call cdmenu.cmd
  519. exit
  520.  
  521.  
  522. tag:      
  523.      if lines(file)<>0 then say 'More, File# ? (Y,n,#)'
  524.      if lines(file)=0 then say  'File# ? (N,#)'
  525.     pull yn
  526.     
  527.     if yn='N' then signal qdel
  528.     dt=datatype(yn)
  529.     if dt='NUM' then do
  530.         tag=yn
  531.         name3=name.tag
  532.         parse var name3 num filename date time desc
  533.         if filename <>'' then do
  534.         call sysfiletree homedir'*.req', 'file.', 'F'
  535.         if file.0=0 then firstime=1
  536.    parse upper var defaultcd dcd
  537.    parse upper var disk curcd
  538.      if dcd=curcd then do
  539.          call lineout homedir''disk'.def',nmi user fulldirectory filename desc
  540.          def=1
  541.      end
  542.        else do
  543.         call lineout homedir''disk'.req',nmi user fulldirectory filename desc
  544.         ok=stream(homedir''disk'.req',c,'close')
  545.         reqflag=1
  546.        end 
  547.      end
  548.     end   
  549.     if yn='' then do 
  550.       if lines(file)=0 then signal qdel
  551.         return
  552.       end
  553.     if yn='Y' then do 
  554.       if lines(file)=0 then signal qdel
  555.         return
  556.      end
  557. call tag
  558.          k=stream(homedir''disk'.def',c,'close')
  559.         ok=stream(homedir''disk'.req',c,'close')
  560. return
  561. msg:
  562. if req=yes then if firstime = 1 then do
  563.   /* MSGAPI */
  564. address CMD 'rxsubcom drop msgapi'
  565. address CMD 'rxsubcom register MSGAPI rxmsgapi RXMSGAPI'
  566. address CMD 'rxsubcom load MSGAPI RXMSGAPI'
  567. address MSGAPI
  568. 'OPEN_API 3 0'
  569. 'OPEN_AREA MSG 'smarea' MSGAREA_NORMAL 'STYPE
  570. 'LOCK MSG'
  571. 'OPEN_MSG MSGH MSG MOPEN_CREATE 0'
  572. cr = '0d'x
  573. text = 'Hello 'SYSOPFIRST',' cr cr 'A User has requested a file from an off-line CD.  Please run CDMenu at your' cr 'earliest convenience.' cr cr '  Thank you,' cr '    CD Carousel' cr cr cr '--- This File was brought to you by CD Carousel'cr      
  574. controla = '01'x
  575. control = controla || 'PID RXMSGAPI'
  576. xmsg.attr = 1
  577. xmsg.from = CD Carousel
  578. xmsg.to = SYSOPFIRST SYSOPLAST
  579. xmsg.subj = 'File Request'
  580. xmsg.orig = tnode
  581. xmsg.dest = fnode
  582. hour=time('N')
  583. date2=date('S')
  584. year=left(date2,4)
  585. month=substr(date2,5,2)
  586. day=right(date2,2)
  587. date1=year'/'month'/'day':'hour
  588. xmsg.date_written = date1
  589. xmsg.date_arrived = date1
  590. xmsg.utc_ofs = 60
  591. xmsg.replyto = 0
  592. xmsg.replies.1 = 0
  593. xmsg.replies.2 = 0
  594. xmsg.replies.3 = 0
  595. xmsg.replies.4 = 0
  596. xmsg.replies.5 = 0
  597. xmsg.replies.6 = 0
  598. xmsg.replies.7 = 0
  599. xmsg.replies.8 = 0
  600. xmsg.replies.9 = 0
  601. xmsg.replies.10 = 0
  602. xmsg.ftsc_date = date('N') time('N')
  603. 'WRITE_MSG MSGH 0 XMSG. TEXT' length(text) length(text) length(control) 'CONTROL'
  604. 'CLOSE_MSG MSGH'
  605. 'UNLOCK MSG'
  606. 'CLOSE_AREA MSG'
  607. 'CLOSE_API'
  608. address CMD 'rxsubcom drop msgapi'
  609. call syssleep 3
  610. end
  611. return
  612.