CTOOLS logo

HappyHours version 1.1.
The Internet freak's best friend.

Current version is HappyHours version 1.1 961203.

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.

happyhours01.gif

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.

happyhours02.gif

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 receiving usenet news and updating CTOOLS internet WEB site, only once a day and only during happy hours.

happyhours03.gif

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.

HappyHours requires AmigaOS 2.04 or better.

Download latest version of HappyHours, v1.1 (8 KB) here.

Follow the development history of HappyHours:

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.

HappyHours, version 1.1 Copyright 1995-1996 Bahman Moallem.
HappyHours.doc v1.1 Copyright 1996 Bahman Moallem.
All Rights Reserved Worldwide.

HappyHours is freely distributable.
Use it at your own risk.
Unlimited non-commercial use and distribution is encouraged.


Copyright © 1995-1997 CTOOLS. Last Modified 1-Jan-97.
For comments, suggestions, questions E-Mail webmaster@ctools.pp.se