home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Current Shareware 1994 January
/
SHAR194.ISO
/
modem
/
dlcalc.zip
/
@ICOM.SCR
next >
Wrap
Text File
|
1993-10-29
|
11KB
|
299 lines
;
; @ICOM.SCR - Install script for DLCALC.SCR
;
; This script will install the download calculator into the script
; directory and optionally rename it so that it can be executed
; from a function key. It also displays some introductory info on what
; the script does.
; Variable declarations
variable wnd_title "Download Calculator Installation Script"
variable wnd_help "Download Calculator Help"
; Menu variables
variable menu1 "~Install Script"
variable menu2 "~Change Target Install Directory"
variable menu3 "~Try it Out First"
variable menu4 "~Help!"
variable menu5 "~Quit"
variable help1 "Install the download calculator"
variable help2 "Change the target installation directory"
variable help3 "Let's see a live demo!"
variable help4 "Download calculator overview"
variable help5 "Quit the installation program. Duh!"
variable install1 "~Yes"
variable install2 "~No"
; Function key codes...
variable F2 "00015360"
variable F3 "00015616"
variable F4 "00015872"
variable F5 "00016128"
variable F6 "00016384"
variable F7 "00016640"
variable F8 "00016896"
variable F9 "00017152"
variable F10 "00017408" ; Sorry, I don't want to support F11 and F12. My
; laptop issues ultra wierd keycodes for these.
variable selection ; Menu selection
variable source_script "dlcalc.scr"
variable target_script ; Target script name for the install
variable scr_dir $SCRIPT_DIR ; Script directory
variable test_scr $CURDIR source_script ; Test script to prove it works!
; Main Logic
wndopen wnd_title 10 5 70 10
print "Welcome to Mike's script installer."
Main_Menu:
; Define the main menu and help prompts
menudefine menu1 menu2 menu3 menu4 menu5
menuhlp 1 help1
menuhlp 2 help2
menuhlp 3 help3
menuhlp 4 help4
menuhlp 5 help5
; Display the main menu
menuboxv "Download Calculator Installer" "Select an Option" selection
assign selection $MENUSELECTION ; Store the selected menu option
; Figure out which menu option was selected
switch $MENUSELECTION
case 1
gosub Install ; Install option selected
endcase
case 2
gosub Change_Directory ; Change directory option selected
endcase
case 3
cls
print "OK, you asked for it!"
print "First, tag some files to download, then press ^BESC"
pause "(hit any key to enter tagger)"
tagger ; Enter tagger
print "Running the download calculator..."
script test_scr ; Run the download calculator script
cls
print "Satisfied? Your registration fee just went up by ^B5^B bucks!"
pause "(press any key to continue)"
goto Main_Menu
endcase
case 4
gosub Help ; On-line help selected
endcase
default ; Quit it ESC or the quit option selected
return
endswitch
goto Main_Menu ; Keep looping until the user exits
Install:
; Define the installation menu
menudefine install1 install2
menuboxv "Install Menu" "Assign to a function key?" selection
; Process based on the menu option selected
switch $MENUSELECTION
case 1
; Show the function key select menu
menudefine "F~2" "F~3" "F~4" "F~5" "F~6" "F~7" "F~8" "F~9" "F1~0"
menuboxv "" "Select a function key" selection
; Figure out which function key was selected
switch $MENUSELECTION
case 1
assign target_script F2 ".SCR"
endcase
case 2
assign target_script F3 ".SCR"
endcase
case 3
assign target_script F4 ".SCR"
endcase
case 4
assign target_script F5 ".SCR"
endcase
case 5
assign target_script F6 ".SCR"
endcase
case 6
assign target_script F7 ".SCR"
endcase
case 7
assign target_script F8 ".SCR"
endcase
case 8
assign target_script F9 ".SCR"
endcase
case 9
assign target_script F10 ".SCR"
endcase
endswitch
endcase
case 2
; Use the default script name
assign target_script source_script
endcase
endswitch
; Create the fully qualified target filename
assign target_script scr_dir target_script
; Check to see if the target already exists
exist target_script gosub Check_Overwrite
; Copy the source script to the target file
print "Copying ^B" source_script "^B to ^B" target_script "^B."
copy source_script target_script
print "Done!"
pause "You're all set. Press any key to exit."
goto Done
return
Check_Overwrite:
; Check to see if the user really wants to overwrite an existing
; script
menudefine install1 install2
menuboxh "The target script already exists" "Overwrite?" selection
switch $MENUSELECTION
case 1
return ; Overwrite the existing script
endcase
case 2
goto Install ; Back to the installation menu
endcase
endswitch
return ; Should never reach here, but return just in case
Change_Directory:
; Select the target install directory. By default, this is the one from
; icom.ini.
boxgets scr_dir 40 "" "Enter the target script directory"
strblank scr_dir assign scr_dir $SCRIPT_DIR
addslash scr_dir ; Add a trailing "\", just in case
return
Help:
; Help Menu stuff...
wndopen wnd_help 1 1 80 25 ; Open the help menu
print "^BOverview:"
print ""
print "The download calculator is a script which reads a selected tagger database"
print "and computes the following:"
print ""
print " Total number of files to download"
print " Total number of bytes to download"
print " Estimated download time (*)"
print " Name of the largest file to download"
print " Size of the largest file to download"
print " Name of the smallest file to download"
print " Size of the smallest file to download"
print ""
print "(*) Note: The Estimated download time can only be calculated if the average"
print "download rate has been defined. You can compute this by looking at your"
print ".use files and computing the average download CPS (characters per second)."
print "Then, enter Intellicom, select ^BIntellicom Setup^B followed by"
print "^BFile Tagger Settings^B and fill in your average download rate at the"
print "^BFile Transfer Speed [CPS]^B prompt. The download calculator uses this"
print "variable for its calculations."
print ""
pause "^BPress any key to continue..."
cls ; Clear the screen
print "^BInstallation:"
print ""
print "This install script will automatically copy the download calculator script"
print "to your script directory. You can override the default script directory"
print "by selecting the ^BChange Install Directory^B option from the main menu."
print "By default, the script will be copied to: ^B" scr_dir "^B."
print ""
print "Select the ^BInstall Script^B option of the main menu to install the script."
print "When installing, you have the choice of either installing the download"
print "calculator as a standard script (^Bdlcalc.scr^B), or it can be renamed to "
print "be executed from a function key."
print ""
print "If you elect to install the script to execute from a function key, you"
print "will be prompted to select the desired function key. ^BNote:^B If you select"
print "a function key which is already in use, you'll be prompted before overwriting."
print "The install script will then copy the download calculator to the appropriate"
print "key code for the desired function key."
print ""
print "For ease of use, I strongly recommend installing the download calculator"
print "to a function key."
print ""
pause "^BPress any key to continue..."
cls ; Clear the screen
print "^BSample Operation:"
print ""
print "Here's a sample scenario of how I use the download calculator. First,"
print "I enter ^BTagger^B and select the files that I want to download. Then,"
print "I press ^BF10^B (where I have the download calculator installed) to pop up"
print "the download calculator. It then prompts for the tagger database to"
print "search (by default this is ^BNEWFILES^B). After selecting the database,"
print "the download calculator computes and displays the various download"
print "statistics. That's all there is to it!"
print ""
print "For people who don't want to run the script from a function key, press"
print "^BALT-U^B to load the script editor and run ^BDLCALC.SCR^B. Note that"
print "the script can be run at ^Bany^B time."
print ""
print "Well, that's about it. And now for the payment details...
print ""
pause "^BPress any key to continue..."
cls ; Clear the screen
print "^BPayment Options:"
print ""
print "As a lot of work went into this script (the install script took longer to"
print "write that the actual program being installed), I want:
print ""
print "A) A million dollars"
print "B) A fridge with a lock on it"
print "C) Huuuuuuuuuge pectoral muscles"
print ""
print "Oh OK, it's yet another ^BFREE^B script. Anyone who wants money for writing"
print "rinkydink scripts needs their head examined."
print ""
print "Enjoy!"
print ""
print "P.S. Please send any comments, criticisms, enhancements to:"
print ""
print "Internet/Usenet: michael.livsey@canrem.com"
print "FidoNet: 1:229/15"
print "RIME/RelayNet: ->CRS"
print ""
pause "^BPress any key to continue..."
wndclose ; Close the help window
return ; End of subroutine
Done:
; We're done. Delete the source files
delete "@icom.scr"
delete "dlcalc.scr"
delete "readme.txt"
exit