NISClock 2.11 (1997.Oct.14) © Copyright 1997 John Muir Written by John Muir ___________________________________________________________________________ Introduction NISClock is a small clock program that displays the time and date on the active public screen. Locale.library is used to format the time and the date that you define. The text of your choosing (the time by default) is displayed in a small window that matches the screen's title-bar colour, or as a screen gadget button look-alike. A mouse click on the window will display a second text (usually the date). NISClock is written in C, and compiled with SAS/C 6.57. Screen Notification NISClock can make use of Stephan Becker's screennotify.library which patches a few intuition.library functions so that the clock will automatically close its window if the Public screen that it inhabits is closed by another program. If NISClock is on the Workbench screen, it will be notified of the close and opening of the Workbench screen by IPrefs for a preferences change or by any other program which calls CloseWorkbench(). The window will then not open until OpenWorkbench() is called. Other Options Other options include window position, justification of the text within the window, a specified amount of time (seconds) to update the clock display, and the ability to avoid certain public screens. ___________________________________________________________________________ Requirements NISClock has the following simple requirements: - Amiga OS V37 (2.04). Uses V39 features if present. - locale.library. - RECOMMENDED: screennotify.library by Stephan Becker. See 'Installation' for more information on screennotify.library. - NISClock must be run from the Workbench; perfect for the WBStartup drawer. ___________________________________________________________________________ Installation Use the Workbench to copy NISClock into the WBStartup drawer to have the program execute as you startup. If you have a 68000, use the CLI to delete NISClock, and rename NISClock_000 as NISClock before copying it. If you decide to use screennotify.library by Stephan Becker for the enhanced features, the library must be installed in LIBS: or PROGDIR: (the directory where NISClock is started from). Get screennotify.library from the distribution archive on AmiNET: /pub/aminet/util/libs/ScreenNotify10.lha (19K) ___________________________________________________________________________ Usage Execution To run NISClock, simply double-click on the icon! To run NISClock at startup, place the program in the WBStartup drawer. NISClock can be halted by executing the program again. NISClock will not run from the CLI. Date and Time Display NISClock will by default display the text defined by TIMEFORMAT. The text defined by DATEFORMAT can be displayed for four seconds by clicking on the NISClock window. If the time text or date text is too big for the current window size, then the window is enlarged to fit the text. The window is never shrunk back. The window will enlarge to the left if EDGE is negative, or if the window does not fit any further right. Similarly, the window will enlarge to the right if EDGE is positive, or the window reaches the left edge of the screen. Use the TOP and EDGE tooltypes to define the position of the NISClock window. Use the JUST tooltype to justify the text within the NISClock window. Active Public Screen NISClock will automatically jump to the active public screen. If NISClock is using screennotify.library, then screen closures will automatically be detected, and the window will be re-opened on the active public screen. Avoiding Public Screens Screens can be avoided through the AVOIDSCR tooltype. That is, NISClock will not open its window on screens that match the pattern given with this tooltype. Custom screens (such as your screen blanker) are automatically avoided. The Workbench screen cannot be avoided, so you can keep the NISClock window on the Workbench screen with by setting "AVOIDSCR=#?". Tooltypes Icon tooltypes are used to control the appearance of NISClock. NISClock will automatically update itself if the icon tooltypes are changed. NISClock accepts the following tooltypes: UPDATE - Numeric; eg: UPDATE=1 - DEFAULT: UPDATE=60 - specifies the window update time in seconds. BUTTON - Boolean - DEFAULT: FALSE - if FALSE, the time is displayed in the title bar colours, otherwise a box is drawn on the edge of the window to match the screen gadget. - NOTE: V37: Backpen = 2 (White) and FrontPen = 1 (Black). EDGE - Numeric; eg: EDGE=400 - the value represents the edge of the NISClock window. - DEFAULT: EDGE=-1 - if the value is negative, this is the right edge of the window + 1, ie: EDGE=-1 signifies that the window is all the way to the right of the screen, except that it must fit around the screen gadget. - the window cannot be positioned with the mouse, so make good use of the file notificaiton on NISClock.info! :) TOP - Numeric; eg: TOP=-4 - Top or bottom edge of the window. - DEFAULT: TOP=0 - if the value is negative, this is the bottom edge of the window + 1, ie: TOP=-1 signifies that the window is against the bottom of the screen. JUST - Enumerated - display the time and/or date with justification; JUST = CENTER, RIGHT, LEFT, or NONE. - DEFAULT: JUST=NONE - NONE means CENTER when BUTTON is true, and RIGHT otherwise. TIMEFORMAT - Text; eg: TIMEFORMAT=Time: %H:%M:%S - DEFAULT: TIMEFORMAT=%Q:%M %p - specifies the format of the time text as defined by the locale.library FormatDate() function. - this is constructed just like C-language printf() statements, except that different formatting codes are used. Just like in C, formatting codes are a % followed by the formatting command. The following commands are accepted by this function (from AutoDocs): %a - abbreviated weekday name %A - weekday name %b - abbreviated month name %B - month name %c - same as "%a %b %d %H:%M:%S %Y" %C - same as "%a %b %e %T %Z %Y" %d - day number with leading 0s %D - same as "%m/%d/%y" %e - day number with leading spaces %h - abbreviated month name %H - hour using 24-hour style with leading 0s %I - hour using 12-hour style with leading 0s %j - julian date %m - month number with leading 0s %M - the number of minutes with leading 0s %n - insert a linefeed %p - AM or PM strings %q - hour using 24-hour style %Q - hour using 12-hour style %r - same as "%I:%M:%S %p" %R - same as "%H:%M" %S - number of seconds with leadings 0s %t - insert a tab character %T - same as "%H:%M:%S" %U - week number, taking Sunday as first day of week %w - weekday number %W - week number, taking Monday as first day of week %x - same as "%m/%d/%y" %X - same as "%H:%M:%S" %y - year using two digits with leading 0s %Y - year using four digits with leading 0s - Note: for some reason, %W and %U don't work properly. Bug in locale.library? DATEFORMAT - Text; eg: DATEFORMAT=%Y/%m/%d - display the date in the requested format. - DEFAULT: DATEFORMAT=%Y.%b.%e - formatting text is as described above. - this text is only displayed for four seconds after the mouse is clicked on the window. AVOIDSCR - Text; eg: AVOIDSCR=(DOPUS.?|PAGESTREAM?) - pattern matching names of screens that NISClock will not jump to. Uses the standard pattern matching that is part of dos.library. - DEFAULT: AVOIDSCR=DOPUS.? - available pattern tokens (from AutoDocs): ? Matches a single character. # Matches the following expression 0 or more times. (ab|cd) Matches any one of the items seperated by '|'. ~ Negates the following expression. It matches all strings that do not match the expression (aka ~(foo) matches all strings that are not exactly "foo"). [abc] Character class: matches any of the characters in the class. [~bc] Character class: matches any of the characters not in the class. a-z Character range (only within character classes). % Matches 0 characters always (useful in "(foo|bar|%)"). * Synonym for "#?", not available by default in 2.0. Available as an option that can be turned on. NOTES: - DOPUS 4.x will attempt to close visiting windows (not a good thing) when it closes its screen. This is a very bad idea, and definitely not good for NISClock which will shortly thereafter cause your machine to crash. - < V39: Put your pattern in uppercase; there was a bug in MatchPatternNoCase(). - You cannot avoid the Workbench screen. Sorry! ;) ___________________________________________________________________________ Comments? Talk to me! EMail: John D. Muir My PGP private key is available on my home page at http://www.poboxes.com/jmuir. ___________________________________________________________________________ History 1.81 (13.1.97) - Fixed a display bug which occured when the Full-Date mode was set. - Moved most of the .readme into .doc for uploading purposes; this file's size was getting rediculous for a .readme. - Default NISClock is now the 020 version, NISClock_000 is the 68000 version. 2.0 (29.9.97) - Localized. - Changed a lot of stuff... - Re-read the documentation. - Automatically resizes the window for the given text. (Previously guessed the maximum...) - Size went from 4272 to 3960, but processing time probably went up due to new calls to Locale.library. 2.1 (1997.Oct.8) - Fixed bugs regarding tooltypes (BUTTON=FALSE didn't work..). - LEFTEDGE -> EDGE, negative values == distance from right side + 1. - EDGE determines in which direction the window is sized. - added TOP tooltype, negative values == distance from bottom + 1. - JUSTIFICATION -> JUST. - Automatically jumps to the active public screen every UPDATE seconds. (You may have to wait if UPDATE=60). Force it by clicking on the window for the date, and moving to the other screen before the time is re-displayed. 2.11 (1997.Oct.14) - BUGFIX: gets stuck on the DOPUS screen because DOPUS is aware of visitor windows, and will attempt to close (!!!!!) them when it quits or iconifies, instead, it should attempt to close and wait for the signal telling it that no windows are on the screen. Fix: added the AVOIDSCR tooltype. When DOPUS closes the NISClock window, the computer WILL crash at the next UPDATE period. ___________________________________________________________________________ To Do Let me know if you have a favorite or suggestions. - Custom time/date formatting strings. - Force the NISClock window to close for a short period of time. May be useful for allowing public screens (eg: MUI's IBrowse screen) to close when the main user program is quit. - Kludge to fix the week number problem. - Automatically detect the size of the gadgets at the top of the screen (window), and display beside them. Screen gadget is currently assumed to be 23 pixels wide. - Attach to windows that are on top of the NISClock window. (eg: your Web Browser). - Run from the CLI.