HappyHours version 1.1 HappyHours, the internet freak's best friend. HappyHours Copyright 95-96 Bahman Moallem. HappyHours.doc v1.1 Copyright 95 Bahman Moallem. All Rights Reserved Worldwide $VER: HappyHours.doc v1.1 Copyright 96 Bahman Moallem. ----------------------------------------------------------------------- DISCLAIMER ----------------------------------------------------------------------- The author of this program is not responsible for any loss of data, damages to software or hardware that may result directly or indirectly from the use of this program. Use this software at your own risk. COPYING ----------------------------------------------------------------------- HappyHours is copyright © 95-96 Bahman Moallem. HappyHours is freely distributable so long as all files accompanying the HappyHours package remain intact and unchanged. Unlimited non-commercial use and distribution is encouraged. Commercial use of HappyHours or inclusion of HappyHours in commercial applications requires expressed written consent. Please contact the author directly for further information. REQUIREMENTS ----------------------------------------------------------------------- AmigaOS 2.04 or better. INSTALLATION AND SETUP ----------------------------------------------------------------------- Copy HappyHours executable to the directory C: or any other directory in the search path of your Amiga. INTRODCTION, PROGRAM DESCRIPTION AND USAGE ----------------------------------------------------------------------- In some countries, including Sweden, the telephone companies charge less money for phone calls during the so called "happy hours". I used to check my internet mailboxes several times a day but I try to do most of the other internet activities during the happy hours. I assume that everyone else who is sitting on a budget is doing the same thing. HappyHours is a CLI/Shell program that I created to automate the process of starting other programs during happy hours or weekends, when charges for phone calls are lower. In its simplest form, HappyHours needs the following 3 arguments to operate. From/A Happy hours start at this time. To/A Happy hours end at this time. Weekend/A/M One or more days when charges for phone calls are lower. Time values should be entered in 4-characters military format. HappyHours supports the localization feature of AmigaOS. You should use the localized names for weekend-days to match the first preferred language that you have chosen in the "Locale Preferences" program. If you are using "Svenska" (Swedish) as your first preferred language, you should replace "Saturday" and "Sunday" in the following example with "Lördag" and "Söndag". In Sweden, the telephone company charges less money for phone calls during weekends (Saturday and Sunday) and between 1800 (6PM) and 0800 (8AM). Upon-startup, HappyHours compares the actual time with the interval entered via the above arguments, and returns a value of 0 if the system time matches the entered values and a bigger value otherwise. The return code can be used in scripts to start other tasks. This could be anything from pooling the usenet news articles or receiving the actual day's TV program. The following script outputs the string "Now starting the happy hours activities" only if the system time is between 1800 (6PM) and 0800 (8AM) or if the script is run during Saturday and Sunday. // ------------------------------------------------- HappyHours FROM=1800 TO=0800 WEEKEND Saturday Sunday IF NOT WARN ECHO "Now starting the happy hours activities" ; Start your progams/scripts here ENDIF // ------------------------------------------------- More options for the power user: The above script is not of much help if you intend to pool your news packet only ONCE a day and only during happy hours. To solve the above problem, 2 additional commands have been implemented in HappyHours. File/K Complete path and name to a file that HappyHours creates for the performed action. Clean/S HappyHours performs housekeeping on File(s) [see above]. Have a look at the extended and more useful version of the above script. The explanation follows afterwards. // ------------------------------------------------- HappyHours FROM=1800 TO=0800 WEEKEND Saturday Sunday FILE=TEMP:NEWS CLEAN IF NOT WARN ECHO "Now starting the happy hours activities" ; Start your progams/scripts here ENDIF // ------------------------------------------------- No matter how many times you run the above script, it outputs the string "Now starting the happy hours activities" only ONE TIME per day and ONLY only during happy hours. Upon-startup, HappyHours checks the system date/time. If the given interval matches the system time, it will search for the file: TEMP:NEWS_ActualDate. If the mentioned file is found, it will return 5, thus nothing happens. If the file is not found, it will create it and returns 0, thus showing the above test string. In the above explanation you should change the string "ActualDate" with the actual date of the program's call. If the actual date is 96-Dec-01, HappyHours will creates the file: TEMP:NEWS_96-Dec-01. If the clean argument is turned on, HappyHours will remove any file that matches TEMP:NEWS_??-???-?? but the actual day's file, TEMP:NEWS_96-Dec-01. I use the following script to automate the process of getting usenet news and updating CTOOLS internet WEB site only once a day and only during happy hours. // ------------------------------------------------- FAILAT 21 HappyHours FROM=1800 TO=0800 WEEKEND Saturday Sunday FILE=HHFILES:NEWS CLEAN IF NOT WARN REXX:MagicNews_Pool.rexx ENDIF HappyHours FROM=1800 TO=0800 WEEKEND Saturday Sunday FILE=HHFILES:CTOOLS CLEAN IF NOT WARN C:NET/MagicFTP remote=www.algonet.se/~CTOOLS local=Internet:CTOOLS L=CTOOLS P=xxxxxx U A V ENDIF // ------------------------------------------------- HappyHours accepts the following 2 arguments in addition to the ones that were mentioned above: Verbose/S Outputs information about performed task in a requester. Version/S Outputs HappyHours version information in a requester. HappyHours understands path/file names of up to 256 characters. Current version of AmigaOS FileSystem can not handle file names that are that long. If you are using AmigaOS native filesystem up to version 3.1, you should limit your file names to 30 characters. HISTORY ----------------------------------------------------------------------- 951004 - version 1.0 This version was never released to the public. 961203 - version 1.1 First version released to the public 8^). Added FILE and CLEAN options to the program. COPYRIGHT NOTICES ----------------------------------------------------------------------- HappyHours version 1.1 © 1995-1996 Bahman Moallem. HappyHours.doc v1.1 © 1996 Bahman Moallem. All program names mentioned in this document are either Copyright or Trademark of their respective owner(s). CONTACT ----------------------------------------------------------------------- If you find some bugs or have some constructive ideas on how to improve HappyHours, please contact the author via Internet mail to: bamo@ctools.pp.se The latest version of HappyHours is always available at the author's WWW site: http://www.ctools.pp.se/