home *** CD-ROM | disk | FTP | other *** search
/ Crawly Crypt Collection 1 / crawlyvol1.bin / bbs / top_dl13 / td.scr < prev    next >
Text File  |  1993-12-30  |  7KB  |  289 lines

  1. SCRIPT
  2. ABORT OFF
  3.  
  4.  ;  ------------------------------------------------------
  5.  ;  -                                                    -
  6.  ;  -  BBS Express! ST Script by Rich Sanchez, Dec 93    -
  7.  ;  -                                                    -
  8.  ;  -  Designed to run TOP_DL.PRG, TOP Download Listers  -
  9.  ;  -  by Marc Ferrari of The Quantum Group.             -
  10.  ;  -                                                    -
  11.  ;  ------------------------------------------------------
  12.  
  13.  
  14.  ; *********************************************************
  15.  ; *** Variables That NEED To Be Changed For Your System ***
  16.  ; *********************************************************
  17.  
  18.     ;  Change the "DEFINE Menu_drive = " line to reflect JUST the Drive
  19.     ;  Letter where THIS Top Down Menu Script is or will be located:
  20.  DEFINE Menu_drive = 'I'
  21.  
  22.     ;  Change the "DEFINE Menu_path = " line to reflect the Path to THIS
  23.     ;  Menu Script:
  24.  DEFINE Menu_path = 'I:\TOP_DL\'
  25.  
  26. ;  ****************************************************************
  27. ;  *** END OF Variables That NEED To Be Changed For Your System ***
  28. ;  ****************************************************************
  29.  
  30.  
  31.  
  32. VAR User_input                  ; Iinput for user selection.
  33. VAR Delay                       ; Time delay on invalid input.
  34. VAR Ch_drive                    ; For drive changes.
  35. VAR Ch_directory                ; For directory changes.
  36. VAR Count
  37. VAR Reports
  38. VAR File_to_view
  39. VAR SIG_count
  40. VAR Temp_var_1
  41. VAR Temp_var_2
  42. VAR Toggle
  43. VAR Counter
  44.  
  45.  
  46.  Ch_drive = FILE_CHGDRIVE ('[Menu_drive]')
  47.  Ch_directory = FILE_CHGDIR ('[Menu_path]')
  48.  
  49.  
  50. Begin_:
  51.  
  52.  CLEAR SCREEN
  53.  
  54.  IF TIME_EXCEEDED THEN
  55.     PRINTE '\n\n'
  56.     PRINTE 'Sorry, your time limit is up for today!' CENTER
  57.     PRINTE '\n\n'
  58.     FOR Delay = 1 to 250 DO
  59.     ENDFOR
  60.     GOTO EOF
  61.  ENDIF
  62.  
  63.  PRINTE
  64.  PRINTE 'Top Download Reports' CENTER
  65.  PRINTE
  66.  
  67.  IF FILE_EXISTS ('td_menu.dat') THEN
  68.     VIEW ('td_menu.dat')
  69.  ELSE
  70.     CLEAR SCREEN
  71.     PRINTE
  72.     PRINTE
  73.     PRINTE 'WARNING!' CENTER
  74.     PRINTE 'TD_MENU.DAT FILE NOT FOUND!' CENTER
  75.     PRINTE 'ATTEMPTING TO CREATE ONE' CENTER
  76.     PRINTE
  77.     PRINTE
  78.     GOTO Build_Script_Menu_
  79.  ENDIF
  80.  
  81.  PRINTE
  82.  IF COMMAND_LEVEL 32 THEN
  83.     PRINT '   Enter File SIG Number, S for SysOp Menu or X to eXit > '
  84.  ELSE
  85.     PRINT '   Enter File SIG Number or X to eXit > '
  86.  ENDIF
  87.  
  88.  
  89. User_Choice_:
  90.  
  91.  INPUT User_input 2 NORETURN
  92.  
  93.  IF User_input = S
  94.     GOTO SysOp_menu_
  95.  EF User_input = X
  96.     GOTO EOF
  97.  ENDIF
  98.  
  99.  CLEAR SCREEN
  100.  
  101.  IF User_input = NUMERIC THEN
  102.     ; Don't do anything
  103.  ELSE
  104.     PRINTE
  105.     PRINTE
  106.     PRINTE 'Invalid Entry!' CENTER
  107.     PRINTE
  108.     PRINTE
  109.     PRINTE '<Press Any Key To Continue>' CENTER
  110.     GET_KEY User_input
  111.     GOTO Begin_
  112.  ENDIF
  113.  
  114.  ; VALID ENTRY
  115.  File_to_view = 'TOP_DL.[User_input]'
  116.  IF FILE_EXISTS ('[File_to_view]') THEN
  117.     VIEW ('[File_to_view]' , SHOWALL PAGEBRK )
  118.  ELSE
  119.     PRINTE
  120.     PRINTE
  121.     PRINTE 'SORRY' CENTER
  122.     PRINTE 'FILE DOES NOT EXIST!' CENTER
  123.     PRINTE
  124.     PRINTE
  125.  ENDIF
  126.  PRINTE '<Press Any Key To Continue>' CENTER
  127.  GET_KEY User_input
  128.  GOTO Begin_
  129.  
  130.  
  131.  
  132. Build_Script_Menu_:
  133.  
  134.  IF COMMAND_LEVEL 32 THEN
  135.  ELSE
  136.     GOTO Begin_:
  137.  ENDIF
  138.  
  139.  ; Now go through and search for the existance of each possible TOP_DL.x
  140.  ; file.  If it exists get the File SIG name from it, manipulate it and
  141.  ; stick it in the appropriate Table array element.  Also check to make
  142.  ; sure there is at least one TOP_DL.x file.  If not create a dummy
  143.  ; TD_MENU.DAT file.
  144.  
  145.  Temp_var_2 = 0         ; Temp counter, number of TOP_DL.x files found
  146.  
  147.  FOR Count = 1 to 32 DO
  148.     Reports = 'TOP_DL.[Count]'
  149.     IF FILE_EXISTS ('[Reports]') THEN
  150.  
  151.        INCREASE Temp_var_2
  152.  
  153.        ; Open the file for INPUT ( Read it ).
  154.        OPEN ( 'TOP_DL.[Count]' , INPUT )
  155.  
  156.        ; Grab line 3 of TOP_DL.x file which contains the SIG Name.
  157.        FINPUT Temp_var_1 3
  158.  
  159.        ; Now close that file.
  160.        CLOSE
  161.  
  162.        ; The TOP_DL.x file has the File SIG Name starting at position 16 of
  163.        ; line 3.  So we want to grab just that portion.  The line should
  164.        ; never be greater than 46.
  165.        Temp_var_1 = COPY ( Temp_var_1 , 16, 46 )
  166.  
  167.  
  168.        ; Take the variable Count which is the SIG number and Expand it to
  169.        ; two characters.
  170.        EXPAND ( Count , 2 )
  171.  
  172.        ; Put the "|" characters at the beginning and end of the SIG number
  173.        ; and add the SIG Name for formatting purposes.
  174.        Temp_var_1 = '   |[Count]|  [Temp_var_1]'
  175.  
  176.  
  177.        ; Now expand that string to 39 characters.
  178.        EXPAND ( Temp_var_1 , 39 )
  179.  
  180.        ; Now stick the formatted string into the Dynamic Table.
  181.        TABLE_PUT ( Count , '[Temp_var_1]' )
  182.     ELSE
  183.        ; If we did not find a TOP_DL.x file then put a 'NOT USED' in that
  184.        ; Table location.
  185.        TABLE_PUT ( Count , 'NOT USED' )
  186.     ENDIF
  187.  ENDFOR
  188.  
  189.  IF Temp_var_2 < 1 THEN
  190.     ; There were no TOP_DL.x files
  191.     OPEN ( 'td_menu.dat' , OUTPUT )
  192.     FPRINTE ''
  193.     FPRINTE ''
  194.     FPRINTE '   No Top x Download Files Found!'
  195.     FPRINTE ''
  196.     FPRINTE ''
  197.     CLOSE
  198.     GOTO Begin_
  199.  ENDIF
  200.  
  201.  
  202.  ; Now copy Table items 1 through 32 which have valid SIG strings into
  203.  ; Table positions 50 up to the number required (82 would be highest)
  204.  Counter = 49
  205.  FOR Count = 1 to 32 DO
  206.     Reports = TABLE_GET (Count)
  207.     IF Reports # 'NOT USED'
  208.        INCREASE Counter
  209.        TABLE_PUT ( Counter , '[Reports]' )
  210.     ENDIF
  211.  ENDFOR
  212.  
  213.  ; Now create a td_menu.dat file which has all the File SIGS for which a
  214.  ; TOP_DL.x file exists.  Format the SIG numbers and names two across.
  215.  
  216.  OPEN ( 'td_menu.dat' , OUTPUT )
  217.  Toggle = 0
  218.  Temp_var_1 = ''
  219.  Temp_var_2 = ''
  220.  INCREASE Counter
  221.  FOR Count = 50 to Counter DO
  222.     INCREASE Toggle
  223.     IF Toggle = 1 THEN
  224.        Temp_var_1 = TABLE_GET (Count)
  225.     ELSEIF Toggle = 2 THEN
  226.        Temp_var_2 = TABLE_GET (Count)
  227.        Reports = '[Temp_var_1][Temp_var_2]'
  228.        FPRINTE '[REPORTS]'
  229.        Toggle = 0
  230.     ENDIF
  231.  ENDFOR
  232.  
  233.  CLOSE
  234.  
  235.  GOTO Begin_
  236.  
  237.  
  238.  
  239.  
  240. SysOp_menu_:
  241.  CLEAR SCREEN
  242.  PRINTE '\n\n\'
  243.  PRINTE '-----------------------' CENTER
  244.  PRINTE '- Top Down SysOp Menu -' CENTER
  245.  PRINTE '-----------------------' CENTER
  246.  PRINTE '\n\n'
  247.  PRINTE '1.  Create New Top Down Reports and TD_MENU.DAT' CENTER
  248.  PRINTE '2.  Create Just a new TD_MENU.DAT              ' CENTER
  249.  PRINTE '3.  Create JUST New Top Down Reports           ' CENTER
  250.  PRINTE '4.  Delete ALL Top Down Reports                ' CENTER
  251.  PRINTE
  252.  PRINTE 'X.  eXit this menu                             ' CENTER
  253.  PRINTE
  254.  PRINT  '       Enter Your Choice> '
  255.  INPUT User_input 1 NORETURN
  256.  
  257.  IF User_input = 1
  258.     GOSUB Kill_reports_
  259.     GEM ('[Menu_path]TOP_DL.PRG')
  260.     GOTO Build_Script_Menu_
  261.  EF User_input = 2
  262.     GOTO Build_Script_Menu_
  263.  EF User_input = 3
  264.     GEM ('[Menu_path]TOP_DL.PRG')
  265.  EF User_input = 4
  266.     GOSUB Kill_reports_
  267.  ENDIF
  268.  GOTO Begin_
  269.  
  270.  
  271. Kill_reports_:
  272.   ; DELETE ALL REPORTS!
  273.  
  274.   FOR Count = 1 to 32 DO
  275.      Reports = 'TOP_DL.[Count]'
  276.      IF FILE_EXISTS ('[Reports]') THEN
  277.         PRINTE '   Deleting [Reports]'
  278.         Temp_var_1 = FILE_DELETE ('[Reports]')
  279.      ENDIF
  280.   ENDFOR
  281. RETURN
  282.  
  283.  
  284. EOF:
  285.    CLOSE
  286.    DEFAULT_PATH
  287.    EXIT
  288.  
  289.