home *** CD-ROM | disk | FTP | other *** search
/ Current Shareware 1994 January / SHAR194.ISO / modem / dlcalc.zip / @ICOM.SCR next >
Text File  |  1993-10-29  |  11KB  |  299 lines

  1. ;
  2. ; @ICOM.SCR - Install script for DLCALC.SCR
  3. ;
  4. ; This script will install the download calculator into the script
  5. ; directory and optionally rename it so that it can be executed
  6. ; from a function key. It also displays some introductory info on what
  7. ; the script does.
  8.  
  9. ; Variable declarations
  10. variable wnd_title  "Download Calculator Installation Script"
  11. variable wnd_help   "Download Calculator Help"
  12.  
  13. ; Menu variables
  14. variable menu1      "~Install Script"
  15. variable menu2      "~Change Target Install Directory"
  16. variable menu3      "~Try it Out First"
  17. variable menu4      "~Help!"
  18. variable menu5      "~Quit"
  19. variable help1      "Install the download calculator"
  20. variable help2      "Change the target installation directory"
  21. variable help3      "Let's see a live demo!"
  22. variable help4      "Download calculator overview"
  23. variable help5      "Quit the installation program. Duh!"
  24. variable install1   "~Yes"
  25. variable install2   "~No"
  26.  
  27. ; Function key codes...
  28. variable F2     "00015360"
  29. variable F3     "00015616"
  30. variable F4     "00015872"
  31. variable F5     "00016128"
  32. variable F6     "00016384"
  33. variable F7     "00016640"
  34. variable F8     "00016896"
  35. variable F9     "00017152"
  36. variable F10    "00017408"  ; Sorry, I don't want to support F11 and F12. My
  37.                             ; laptop issues ultra wierd keycodes for these.
  38.  
  39. variable    selection       ; Menu selection
  40. variable    source_script "dlcalc.scr"
  41. variable    target_script   ; Target script name for the install
  42. variable    scr_dir $SCRIPT_DIR     ; Script directory
  43. variable    test_scr $CURDIR source_script  ; Test script to prove it works!
  44.  
  45. ; Main Logic
  46. wndopen wnd_title 10 5 70 10
  47. print "Welcome to Mike's script installer."
  48.  
  49. Main_Menu:
  50.  
  51. ; Define the main menu and help prompts
  52. menudefine menu1 menu2 menu3 menu4 menu5
  53. menuhlp 1 help1
  54. menuhlp 2 help2
  55. menuhlp 3 help3
  56. menuhlp 4 help4
  57. menuhlp 5 help5
  58.  
  59. ; Display the main menu
  60. menuboxv "Download Calculator Installer" "Select an Option" selection
  61.  
  62. assign selection $MENUSELECTION     ; Store the selected menu option
  63.  
  64. ; Figure out which menu option was selected
  65. switch $MENUSELECTION
  66.     case 1
  67.         gosub Install   ; Install option selected
  68.     endcase
  69.  
  70.     case 2
  71.         gosub Change_Directory  ; Change directory option selected
  72.     endcase
  73.  
  74.     case 3
  75.         cls
  76.         print "OK, you asked for it!"
  77.         print "First, tag some files to download, then press ^BESC"
  78.         pause "(hit any key to enter tagger)"
  79.         tagger  ; Enter tagger
  80.         print "Running the download calculator..."
  81.         script test_scr ; Run the download calculator script
  82.         cls
  83.         print "Satisfied? Your registration fee just went up by ^B5^B bucks!"
  84.         pause "(press any key to continue)"
  85.         goto Main_Menu
  86.     endcase
  87.  
  88.     case 4
  89.         gosub Help          ; On-line help selected
  90.     endcase
  91.  
  92.     default                 ; Quit it ESC or the quit option selected
  93.         return
  94. endswitch
  95.  
  96. goto Main_Menu              ; Keep looping until the user exits
  97.  
  98. Install:
  99.     ; Define the installation menu
  100.     menudefine install1 install2
  101.     menuboxv "Install Menu" "Assign to a function key?" selection
  102.  
  103.     ; Process based on the menu option selected
  104.     switch $MENUSELECTION
  105.         case 1
  106.             ; Show the function key select menu
  107.             menudefine "F~2" "F~3" "F~4" "F~5" "F~6" "F~7" "F~8" "F~9" "F1~0"
  108.             menuboxv "" "Select a function key" selection
  109.  
  110.             ; Figure out which function key was selected
  111.             switch $MENUSELECTION
  112.                 case 1
  113.                     assign target_script F2 ".SCR"
  114.                 endcase
  115.  
  116.                 case 2
  117.                     assign target_script F3 ".SCR"
  118.                 endcase
  119.  
  120.                 case 3
  121.                     assign target_script F4 ".SCR"
  122.                 endcase
  123.  
  124.                 case 4
  125.                     assign target_script F5 ".SCR"
  126.                 endcase
  127.  
  128.                 case 5
  129.                     assign target_script F6 ".SCR"
  130.                 endcase
  131.  
  132.                 case 6
  133.                     assign target_script F7 ".SCR"
  134.                 endcase
  135.  
  136.                 case 7
  137.                     assign target_script F8 ".SCR"
  138.                 endcase
  139.  
  140.                 case 8
  141.                     assign target_script F9 ".SCR"
  142.                 endcase
  143.  
  144.                 case 9
  145.                     assign target_script F10 ".SCR"
  146.                 endcase
  147.             endswitch
  148.         endcase
  149.  
  150.         case 2
  151.             ; Use the default script name
  152.             assign target_script source_script
  153.         endcase
  154.  
  155.     endswitch
  156.     
  157.     ; Create the fully qualified target filename
  158.     assign target_script scr_dir target_script
  159.  
  160.     ; Check to see if the target already exists
  161.     exist target_script gosub Check_Overwrite
  162.         
  163.     ; Copy the source script to the target file
  164.     print "Copying ^B" source_script "^B to ^B" target_script "^B."
  165.     copy source_script target_script
  166.     print "Done!"
  167.     pause "You're all set. Press any key to exit."
  168.     goto Done
  169.     return
  170.  
  171. Check_Overwrite:
  172.  
  173.     ; Check to see if the user really wants to overwrite an existing
  174.     ; script
  175.     menudefine install1 install2
  176.     menuboxh "The target script already exists" "Overwrite?" selection
  177.  
  178.     switch $MENUSELECTION
  179.         case 1
  180.             return   ; Overwrite the existing script
  181.         endcase
  182.  
  183.         case 2
  184.             goto Install    ; Back to the installation menu
  185.         endcase
  186.     endswitch
  187.  
  188.     return  ; Should never reach here, but return just in case
  189.  
  190. Change_Directory:
  191.  
  192.     ; Select the target install directory. By default, this is the one from
  193.     ; icom.ini.
  194.     boxgets scr_dir 40 "" "Enter the target script directory"
  195.     strblank scr_dir assign scr_dir $SCRIPT_DIR
  196.     addslash scr_dir    ; Add a trailing "\", just in case
  197.  
  198.     return
  199.  
  200. Help:
  201.     ; Help Menu stuff...
  202.     wndopen wnd_help 1 1 80 25    ; Open the help menu
  203.     print "^BOverview:"
  204.     print ""
  205.     print "The download calculator is a script which reads a selected tagger database"
  206.     print "and computes the following:"
  207.     print ""
  208.     print "    Total number of files to download"
  209.     print "    Total number of bytes to download"
  210.     print "    Estimated download time (*)"
  211.     print "    Name of the largest file to download"
  212.     print "    Size of the largest file to download"
  213.     print "    Name of the smallest file to download"
  214.     print "    Size of the smallest file to download"
  215.     print ""
  216.     print "(*) Note: The Estimated download time can only be calculated if the average"
  217.     print "download rate has been defined. You can compute this by looking at your"
  218.     print ".use files and computing the average download CPS (characters per second)."
  219.     print "Then, enter Intellicom, select ^BIntellicom Setup^B followed by"
  220.     print "^BFile Tagger Settings^B and fill in your average download rate at the"
  221.     print "^BFile Transfer Speed [CPS]^B prompt. The download calculator uses this"
  222.     print "variable for its calculations."
  223.     print ""
  224.     pause "^BPress any key to continue..."
  225.  
  226.     cls     ; Clear the screen
  227.     print "^BInstallation:"
  228.     print ""
  229.     print "This install script will automatically copy the download calculator script"
  230.     print "to your script directory. You can override the default script directory"
  231.     print "by selecting the ^BChange Install Directory^B option from the main menu."
  232.     print "By default, the script will be copied to: ^B" scr_dir "^B."
  233.     print ""
  234.     print "Select the ^BInstall Script^B option of the main menu to install the script."
  235.     print "When installing, you have the choice of either installing the download"
  236.     print "calculator as a standard script (^Bdlcalc.scr^B), or it can be renamed to " 
  237.     print "be executed from a function key."
  238.     print ""
  239.     print "If you elect to install the script to execute from a function key, you"
  240.     print "will be prompted to select the desired function key. ^BNote:^B If you select"
  241.     print "a function key which is already in use, you'll be prompted before overwriting."
  242.     print "The install script will then copy the download calculator to the appropriate"
  243.     print "key code for the desired function key."
  244.     print ""
  245.     print "For ease of use, I strongly recommend installing the download calculator"
  246.     print "to a function key."
  247.     print ""
  248.     pause "^BPress any key to continue..."
  249.  
  250.     cls        ; Clear the screen
  251.     print "^BSample Operation:"
  252.     print ""
  253.     print "Here's a sample scenario of how I use the download calculator. First,"
  254.     print "I enter ^BTagger^B and select the files that I want to download. Then,"
  255.     print "I press ^BF10^B (where I have the download calculator installed) to pop up"
  256.     print "the download calculator. It then prompts for the tagger database to"
  257.     print "search (by default this is ^BNEWFILES^B). After selecting the database,"
  258.     print "the download calculator computes and displays the various download"
  259.     print "statistics. That's all there is to it!"
  260.     print ""
  261.     print "For people who don't want to run the script from a function key, press"
  262.     print "^BALT-U^B to load the script editor and run ^BDLCALC.SCR^B. Note that"
  263.     print "the script can be run at ^Bany^B time."
  264.     print ""
  265.     print "Well, that's about it. And now for the payment details...
  266.     print ""
  267.     pause "^BPress any key to continue..."
  268.  
  269.     cls     ; Clear the screen
  270.     print "^BPayment Options:"
  271.     print ""
  272.     print "As a lot of work went into this script (the install script took longer to"
  273.     print "write that the actual program being installed), I want:
  274.     print ""
  275.     print "A) A million dollars"
  276.     print "B) A fridge with a lock on it"
  277.     print "C) Huuuuuuuuuge pectoral muscles"
  278.     print ""
  279.     print "Oh OK, it's yet another ^BFREE^B script. Anyone who wants money for writing"
  280.     print "rinkydink scripts needs their head examined."
  281.     print ""
  282.     print "Enjoy!"
  283.     print ""
  284.     print "P.S. Please send any comments, criticisms, enhancements to:"
  285.     print ""
  286.     print "Internet/Usenet:   michael.livsey@canrem.com"
  287.     print "FidoNet:           1:229/15"
  288.     print "RIME/RelayNet:     ->CRS"
  289.     print ""
  290.     pause "^BPress any key to continue..."
  291.     wndclose    ; Close the help window
  292.     return      ; End of subroutine
  293.  
  294. Done:
  295. ; We're done. Delete the source files
  296. delete "@icom.scr"
  297. delete "dlcalc.scr"
  298. delete "readme.txt"
  299. exit