ClockDJ - Assembly language clock, mouse, screen and window program. Version - 4.07 Copyright - Copyright (c) by David Jenkins. I can be reached at Bloom Beacon 416-283-5924. This program is copyright but may be distributed freely. Please keep the documentation with the load module. Version 4.07 ~~~~~~~~~~~~ 1. When flipping screens, the window under the pointer becomes active irrespective of the Sun Mouse or Key Activate settings. 2. A bug in the mouse button routine has been fixed. Version 4.06 ~~~~~~~~~~~~ The clock window can now be popped to the next screen immediately by holding down the left shift key while clicking the left mouse button in the clock window. The key re-mapping routines have been re-written; the delay parameter used when submitting a string should not now be needed (although it is still valid to specify it). Version 4.05 ~~~~~~~~~~~~ Fixed a bug in defining keypad keys as a macro. Eg. a macro like this: \lal\kp7\run ed\r\c should now work. Version 4.04 ~~~~~~~~~~~~ Click to front now gives you the option of keeping or discarding the last of the left mouse button clicks which brings the window to front. There is a 'Discard' sub-menu item under 'Click to Front'. If 'Discard' is checked the last mouse click is discarded. The difference this option makes is mainly seen when the last mouse click is on an icon or other field you wish to select. To find out which to use, experiment. Version 4.03 ~~~~~~~~~~~~ This version fixes a bug which made Key Activate unreliable. Version 4.02 ~~~~~~~~~~~~ Version 4.02 includes a couple of improvements in the click to front and click to back routines: 1. The click to front code removes the last mouse button click to prevent something unintentional happening when you simply want to click a window to the front. 2. In this version you can hold down the left mouse button and click many windows to the back (with the right mouse button) without having to release the left button. The zoo file also has WTFPatch3 which has a corresponding change and should replace WTFPatch2 in your startup sequence. Version 4.01 ~~~~~~~~~~~~ This version fixes a bug which caused a machine freeze when the left mouse button was pressed under some circumstances. Version 4.00 ~~~~~~~~~~~~ This version has an AREXX port. See the ARexx section for details. Version 3.09 changes ~~~~~~~~~~~~~~~~~~~~ 1. This version supports the Arp 1.3 file requester. Also, a new parameter is supported in the macro to give you the option of changing the colours of the requester. For example: \lal\`\&arf1\r\s\2 ^ gives colour 1 \lal\`\&arf2\r\s\2 ^ gives colour 2 2. The 'Load Keys' will now bring up the Arp file requester. Version 3.08 changes ~~~~~~~~~~~~~~~~~~~~ 1. The main change in this version is the ability to invoke the Arp file requester from a macro. For this to work you must have V 34 of Arp.Library in your libs: directory. To call the requester include a macro that looks like this: \lal\`\&arf\r\s\2 This will open the requester on the top screen when you press the Left-alt and ` (top left of the keyboard) together. Obviously you can make the key combination anything you want. When you have selected a file from the requester, the next left mouse button click will cause the selected file (including disk and dir) to be entered into the window where you click. The character delay (2 in the above example) will be observed. There are a couple of ways to modify the string that is generated: Holding down Left Shift when you click will insert a right Amiga x at the start of the characters; this is useful for clearing existing data out of a string gadget. Holding down CTRL will submit the directory for the first mouse click and the file for the second. This is useful for filling in strings where the directory and file are in separate gadgets (in Dpaint, for example). Holding down CTRL+Left Shift when you click will submit the directory and file names separately and precede each with a Right Amiga x. 2. I check for some more snooze shapes in this version. Snooze blank suppression should now work on Dpaint, Professional Page and Draw Plus. Version 3.07 changes ~~~~~~~~~~~~~~~~~~~~ 1. The Mouse Speed menu item contains entries 7 and 8; these entries give additional speed. 2. The Blank Pointer menu item now contains a Snooze Off entry. When it is checkmarked the pointer will not blank if it is a snooze pointer. This can avoid having to move the mouse to see if an operation is complete when the pointer has been blanked. 3. A couple of bugs are fixed. Version 3.06 changes ~~~~~~~~~~~~~~~~~~~~ A bug in the screen blanker caused an occasional guru; V3.06 fixes this. Version 3.05 changes ~~~~~~~~~~~~~~~~~~~~ The arc file contains 'WTFPATCH3', an improved version of the WindowToFront patch. Include 'WTFPatch3' in your start-up sequence, but make sure you remove the old version of the patch (WTFPatch) first. 'WTFPatch3' corrects an Intuition bug in WindoToFront and WindowToBack. To use it, simply put the 'WTFPatch3' program in your c: directory and include 'WTFPatch3' in your startup sequence. Previous versions of the clock had timing code designed to get around the Intuition bug. The patch is more effective and should eliminate machine lockups caused by WindowToFront. Since the timing code has been removed from V3.05 and above, you must run 'WTFPatch3' with this version of the clock. Program Description ~~~~~~~~~~~~~~~~~~~ This utility combines a clock, mouse accelerator, screen blanker, window manipulator, function keys and macros. The display is a small borderless window which shows the total memory left in the system (chip and fast) and the time in 12 hour format. The window pops to the front of the workbench screen once every minute. You can start the program with a 'Run ClockDJ' or 'Runback ClockDJ'. (Do NOT use Workbench 1.3 'run >nil:' or the ARP Arun NOIO commands. Only RunBack will work correctly in this situation). Using 'Runback' is useful if you want to close ALL CLI windows. If you start the clock with 'Runback', the output which is directed to the default CLI will not be seen. This is not usually a problem since this output is typically of the '[CLI 3]' variety. If you use 'Runback' to start the program, command macros (those ending with a '\c') MUST specify output and input redirection to nil:. Eg.: ~~~~ \lal\b\run nil: blitz\r\c If you do not do this the MACHINE WILL GURU. If you want to start the clock with a 'run' so that the output from macros to the default CLI is preserved, but the startup CLI is to be closed, do something like this: newcli "con:0/0/580/200/AmigaDOS " from df0:command.file endcli > nil: "commands.file" is a file located on df0: containing the following: run clockdj Starting the clock in this way preserves the file handle of the CLI which launched the clock and passes it to programs started by the macros. Start-up parameters ~~~~~~~~~~~~~~~~~~~ "r" specified as the first parameter will reverse the action of the mouse buttons for the features that require both to be depressed. The default is "n", for normal operation. The "Newcli" entry in the menu may now be changed by specifying a second parameter when starting the clock. Eg.: run clockdj n NewWsh con:0/0/640/150/Myname Note that if the second parameter is specified, the first parameter must also be specified. Arp File requester ~~~~~~~~~~~~~~~~~~ The Arp file requester can be called from a macro. For this to work you must have V 34 of Arp.Library in your libs: directory. To call the requester include a macro that looks like this: \lal\`\&arfx\r\s\2 where x is either 1 or 2. The numbers change the colour scheme of the requester, This will open the requester on the top screen when you press the Left-alt and ` (top left of the keyboard) together. Obviously you can make the key combination anything you want. When you have selected a file from the requester, the next left mouse button click will cause the selected file (including disk and dir) to be entered into the window where you click. The character delay (2 in the above example) will be observed. There are a couple of ways to modify the string that is generated: Holding down Left Shift when you click will insert a right Amiga x at the start of the characters; this is useful for clearing existing data out of a string gadget. Holding down CTRL will submit the directory for the first mouse click and the file for the second. This is useful for filling in strings where the directory and file are in separate gadgets (in Dpaint, for example). Holding down CTRL+Left Shift when you click will submit the directory and file names separately and precede each with a Right Amiga x. If '&arf' is specified as the string, no other characters are valid in the string field other than 1 or 2 (to change the colours). Window manipulation ~~~~~~~~~~~~~~~~~~~ The following can be selected from the menu or by clicking the correct combination of mouse buttons: 1. Screen blanking after a pre-defined period of inactivity. 2. Pointer blanking after a pre-defined period of inactivity. 3. Mouse accelerator. 4. Sun mouse. 5. Click the window to front with the left mouse button. 6. Click the window to back by pressing the left mouse button followed by the right mouse button, with the left button still down. 7. Cycling through screens by pressing the right mouse button followed by the left mouse button with the right button still down. 8. Left-Amiga-m will shuffle screens if "Screen Cycle" is selected. The button sequences for 6. and 7. can be reversed by specifying the parameter "r" when starting the clock: eg: run clockdj r All the above can be selected my menus and saved in the configuration file. Delete Window ~~~~~~~~~~~~~ The program will allow the user to select a window and remove it from the screen while leaving the task that started it unaffected. To do this, point at the window you want to remove, hold the Left-shift+Left-Amiga+Control keys down and press the left mouse button; the window should disappear. To bring the window back hold Left-shift+Left-Amiga+Control keys and press the right mouse button. Up to 60 windows can be hidden in this way. When retrieving windows the last one removed is brought back first. A separate list of hidden windows is maintained for each screen, so only the windows for the active screen are retrieved. I put this feature in because my workbench screen is often cluttered with small windows opened by tasks like VirusX. These windows serve no useful purpose and I decided I would like a means of removing them. Restrictions: 1. CLI windows cannot be removed. Doing so confuses things and ends in a guru, so the CLI windows are ignored when selecting a window to hide. 2. Some programs look at their window size; FileInjector does this. If the small FileInjector window is hidden and the hot key sequence is used, the resulting window is smaller than it should be. The solution is one of: don't hide this type of window; retrieve the window before the hot key; retrieve the window after the hot key. The last option would require a window refresh too (move the window). 3. You should use this feature with caution. Some programs don't expect to have other tasks interfere with their windows and gurus can occur. Generally, if the window holds only text then there will not be a problem. Changing the window size of the clock display ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ The size of the clock window can be changed by hitting Left-shift+Left+alt+Right-shift+up arrow or down arrow. This will allow the characters of larger fonts to be displayed correctly. The size will be saved in the config file when "Save" is selected from the menu. Moving the clock window to another screen ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ The clock window can be popped to the next screen immediately by holding down the left shift key while clicking the left mouse button in the clock window. This feature works whatever is selected in the Pop to Front menu item. Menu options ~~~~~~~~~~~~ NewCLI ------ Gives you a new CLI window at the bottom of the screen. Chip/Fast --------- This option gives chip and fast memory displays separately. When selected the menu toggles to "Total Memory" to enable you to get back to a total memory display. Colour ----- Allows you to select the colour of the clock display. Priority -------- The default priority of the clock is 2 which seems to work OK in most circumstances. Setting it to 0 makes it the same priority as other tasks started from CLI. Making it negative gives it a lower priority than other CLI tasks. This option gives you a choice of running the clock from -3 to +4. I found the negative values useful while running a Basic drawing program: anything above -1 made the drawing process jerky. Refresh ------- This is the maximum rate at which the program will update the display. The default is 5 times per second and the options allow from 10 times to once per second. I only do an PrintIText if something has changed, so even 10 times per second does not use much CPU - you can use pm to see how much. Blank Screen ------------ The screen will blank after the specified time (in minutes) if there is no keyboard or mouse activity. Blank Pointer ------------- The mouse pointer will blank after the specified time (in seconds) if there is no mouse activity. When the Snooze Off entry is checkmarked the pointer will not blank if it is a snooze pointer. This can avoid having to move the mouse to see if an operation is complete when the pointer has been blanked. Mouse Speed ----------- Accelerates the mouse pointer. 1 is no acceleration. Click to front -------------- Clicking the left mouse button in a window the specified number of times will bring it to the front. Click to front now gives you the option of keeping or discarding the last of the left mouse button clicks which brings the window to front. There is a 'Discard' sub-menu item under 'Click to Front'. If 'Discard' is checked the last mouse click is discarded. The difference this option makes is mainly seen when the last mouse click is on an icon or other field you wish to select. To find out which to use, experiment. Click to back ------------- Click the window to back by pressing the left mouse button followed by the right mouse button the specified number of times. Note that this sequence can be reversed by specifying "r" as a start-up parameter Sun Mouse --------- Activates the window the pointer is above without having to click the left mouse button. Screen Cycle ------------ Cycling through screens by pressing the right mouse button followed by the left mouse button with the right button still down. Note that this sequence can be reversed by specifying "r" as a start-up parameter The screen cycle can also be triggered by hitting Left-Amiga-m. Key Activate ------------ If this feature is used, the window under the pointer will be activated when a key is depressed. Pop to Front ------------ Selecting this item causes the clock to pop to the front of the current screen if 'Windows' is selected, or to the top screen if 'Screens' is selected. Map Keys -------- When checked, the key mapping and macro functions are active. Load Keys --------- Loads in a new set of key and macro definitions. Save ---- If you select "Save", all the current settings, including the window position, will be written to a file called "clockdj.config" in the root directory of sys:. You should be careful to ensure that sys: is assigned to the correct disk so that the file can be read when the clock is next started. The next time clockdj starts it will attempt to read this file and set up the clock and associated parameters exactly as they were when you selected "Save". You should select this option when you are happy with the way the clock looks, and then make sure you have the disk with the clockdj program on it assigned to sys:. Quit ---- Ends the program. Macros and redefining the keys ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ ClockDJ will allow you re-map the keyboard, substitute a string of characters for a single key depression, or execute a command when a particular key sequence is pressed. The key definitions and macros must be created by you and saved in a file; the default file read when the program starts is sys:clockdj.keys. The key definitions can be changed by selecting Load Keys from the menu. Pressing CTRL-` (the "ctrl" key and the "`" key) is an escape for the next key/mouse sequence entered. This will prevent translation or macro generation on the next key/mouse sequence. NB. 'Map Keys' must be selected from the menu to activate the macro function. The statement format is: \xxx,yyy\z\wwwwww\r\s\5 | | | | k c | | | | | | | |_The delay between each character in 10ms increments. | | | | | | | | | | | |_ s = string; c = command | | | | | | | | | |_ r = replace character with the string or command | | | | k = generate string or command, but keep the original | | | | character. | | | | | | | |_ String to be generated, or command to be executed. | | | | | |_ Character to be re-mapped. | | | |_ List of qualifiers (see below), separated by commas. | | |_ Delimiter. Delimiter --------- A "\" is the character used to delimit fields. If you wish to include one in the string, precede it with a "^". Qualifiers ---------- This defines which keys must be pressed with the re-map character to generate the string or command. eg., you may want the qualifiers to be left shift and right alt. If no qualifiers are needed to trigger the re-map, the statement would start with a "\\". Multiple qualifiers are specified by separating them by commas: eg., "lsh,lat,ctl". The valid qualifiers are: (all in lower case) lsh Left shift. rsh Right shift. clo Caps lock. ctl Control (CTRL). lal Left alt. ral Right alt. lam Left Amiga. ram Right Amiga. The above qualifiers must be specified in lower case. ~~~~ Character to be re-mapped. ------------------------ This field is either a single character - "w", for example - or a string of characters which represents a single character. If a single character is specified it must be in lower case; if you want the upper case character re-mapped you must use two statements with "lsh" and "rsh" qualifiers. This also applies to keys like "{", "!" etc. whose lower and upper case representations are different. Valid strings are: (in lower case) f01 The function keys. f02 | f03 | f04 | f05 | f06 | f07 | f08 | f09 | f10 V hel Help key. esc Escape key. tab Tab key. bsp Backspace key. ret Return key. del Delete key. upa Up arrow. lea Left arrow. doa Down arrow. ria Right arrow. kp0 Key pad 0. kp1 Key pad 1. kp2 Key pad 2. kp3 Key pad 3. kp4 Key pad 4. kp5 Key pad 5. kp6 Key pad 6. kp7 Key pad 7. kp8 Key pad 8. kp9 Key pad 9. kp. Key pad .. kp- Key pad -. kpe Key pad enter. kp) Key pad ). kp( Key pad (. kp/ Key pad /. kp+ Key pad +. arf Arp file requester (valid in the string field only). The above keys must be specified in lower case. ~~~~ String ------ The string of characters which will replace the character to be re-mapped. Version 3.00 will accept special keys (del, bsp, for example) in the string. They are specified by preceding the key name with a "&". For example, "&del" would be delete, "&ret" would be return, etc. Any key listed above in the "Character to be re-mapped" section can be specified in this way (still in lower case). Previous version of the program allowed a limited set of control characters in the string by using the "^". This will still work. The characters which can be defined in this way are: ^[ Escape. ^h Backspace. ^i Tab. ^m Return. The "^" and "\" can be included in the string by preceding them with a "^". A character in a macro string may now include a qualifier. Any of the qualifiers listed above under "Qualifiers" are valid. The qualifier is preceded by a "%" and multiple qualifiers are separated by commas. Eg., "%lal,%ctla" (in lower case) would specify left-alt-control-a. Multiple qualifiers should be separated by commas. This can be useful for entering data in a string gadget (a file requester, for example). The file name you want in the requester may be "myfile"; specifying "%ramxmyfile" in the string would clear the gadget before filling it with "myfile". The string should appear in the active window. Each statement can be up to 1000 characters long. Replace/Keep ------------ An "r" causes the re-mapped character to be replaced with the string or command. A "k" will keep the re-mapped character. This must be specified in lower case. String/Command -------------- An "s" will submit the string into the input stream: it should appear in the active window. A "c" will execute the string as a command. A "^m" (CR) or "&ret" at the end of the command is not needed. The command will be launched from the clock task AT THE SAME PRIORITY AS THE CLOCK; the default clock priority is 2. Some programs do not run well at priority 2 - eg Txed, Excellence, Blitz - since they use input handlers running at priority 0. To avoid this kind of problem either run the clock at priority 0 or use the ARP Arun command and set the priority of the new task to 0. This must be specified in lower case. Delay ----- Some programs will not accept a continuous stream of characters in the input stream. CygnusED and Online! will not, for example. The delay value will delay each character by the value*15 milliseconds. Eg., a value of 5 specifies 75 ms. CLI windows do not need a delay; you should experiment to find out whether a program you are using needs the delay. The delay field can be between 0 and 9. If the delay is omitted, a delay of 0 is assumed. Examples ~~~~~~~~ \\f01\run >nil: nil: nil:\r\c Start a new cli when Left-alt esc is depressed. \lal\n\David Jenkins\r\s\5 Submit the string when left-alt n is depressed and insert a 50 ms delay between each character. \lal\m\Inter-Office Correspondence&ret&retFrom: David Jenkins&ret&retTo:&ret&retSubject:&ret&ret______________________________________________________________________________&ret&ret\r\s\5 Submit the string when left-alt m is depressed and insert a 50 ms delay between each character.. \clo\`\~\r\s \clo\1\!\r\s Convert Caps lock "`" and "1" to "~" and "!". \lal\f\%ramxdf0:file1\r\s Is useful for putting a string into a requester. The "%ramx" will submit a Right Amiga-x which will clear the string gadget before submitting the "file1" string. ARexx Macros ~~~~~~~~~~~~ ClockDJ versions 4.00 and above contain an ARexx port. The clock is an ARexx host and will accept commands from an ARexx program; the commands are listed below. If a result is expected it will be returned in the special ARexx variable 'result'; any commands which return a result should have a 'options results' statement in the program. Title of ClockDJ ---------------- The clock window has a title of 'ClockDJ' (case sensitive); you can use this title in some of the ARexx macros. For an example of this take a look at Move.Rexx and Move2.Rexx. Host Name --------- The host name of ClockDJ is CLOCKDJ (in capitals). Errors ------ Errors are reported by setting a return code (the RC variable). A return code of 20 is set for an unrecognized command. A return code of 10 is set for an invalid parameter (an invalid window address, for example). Commands -------- NOTE: when executing commands which manipulate windows (like MOVE), be careful not to submit too many requests for the same window without a pause between the requests. Intuition gets upset if it receives a request for a window before it has acted on the previous request; the ARexx function 'delay' (in rexxsupport.library) can be used to accomplish this: eg., 'call delay 5'. ACTIVATEWINDOW address Activate the window with this address. The window may be on any screen. ******************* COLOUR nn Change the colour of the clock display to nn (0-11). Note: nn corresponds to a colour item menu selection ******************* CHIP Change the clock to display chip/fast memory. ******************* DELAY value Specify an inter-character delay value in microseconds for injected data. The delay value remains in effect for all injected data; if you want to reset it to zero, submit a 'delay 0' command. ******************* FILEREQUESTER Call the Arp file requester. The full pathname of the selected file will be returned in 'result'. If 'cancel' is selected on the Arp file requester, a null string will be returned in 'result'. ******************* GETACTIVEWINDOW Gets the active window address and returns it in 'result'. ******************* GETNEXTWINDOW address Get the address of the next window on a screen. The parameter is an address of a window. ******************* GETPOINTERWINDOW Get the address of the window under the pointer. The address is returned in 'result'. ******************* GETSCREEN title Get the screen address from the title. Note that the title is case sensitive. The address is returned in 'result'. ******************* GETTITLEOFSCREEN address Get a screen title from a screen address. The title is returned in 'result'. ******************* GETTOPSCREEN Get the address of the top screen. The address is returned in 'result'. ******************* GETWINDOW title Get the address of the window with this title. The address is returned in 'result'. Note that 'title' is case sensitive; make sure you specify the exact title. The window can be on any screen. ******************* HIDEWINDOW address Hide the window with the specified address. ******************* INJECT CLICK data Injects data into the window where you click the left mouse button. A small window will appear on the top screen asking you to click where you want the data injected. The data to be injected is specified by the second operand. If you precede the data by a hex '01' ('01'x in ARexx), a Right Amiga+x will be inserted to clear a string requester). ******************* INJECT ACTIVE data Injects data into the active window. The data to be injected is specified by the second operand. ******************* INJECT address data Injects data into the window with the the address specified in the first operand. The data is specified by the second operand. ******************* LOADKEYS filename Load new key definitions from the specified file name. ******************* MOVEWINDOW address x-position y-position Move a window to a new position. The first parameter is a window address, the second is the X position and the third is the Y position. If you attempt to move a window outside a screen's limits a return code of 10 will be set. ******************* POPUP OFF WINDOWS SCREENS Set the popup status of the clock. ******************* QUALIFIER 'nnnn'x Set a key qualifier for injected data. The qualifier is 2 hex bytes and the values are explained below. This feature is useful if you want to inject, for example, a Right Amiga+Right Shift+Return. The qualifier remains set for all injected data, so you must reset it. A normal key depression has a qualifier of '8000'x (relative mouse). NOTE: this is only effective for data injected with INJECT ACTIVE or INJECT address. It will not work with INJECT CLICK. Qualifiers ---------- IEQUALIFIER_LSHIFT EQU $0001 Left shift IEQUALIFIER_RSHIFT EQU $0002 Right Shift IEQUALIFIER_CAPSLOCK EQU $0004 Caps Lock IEQUALIFIER_CONTROL EQU $0008 CTRL IEQUALIFIER_LALT EQU $0010 Left Alt IEQUALIFIER_RALT EQU $0020 Right Alt IEQUALIFIER_LCOMMAND EQU $0040 Left Amiga IEQUALIFIER_RCOMMAND EQU $0080 Right Amiga IEQUALIFIER_RELATIVEMOUSE EQU $8000 Reset to this value. NB. OR the bits together to set a qualifier: eg: '8022'x is Right shift+ Right alt+Relative mouse. You should always include the relative mouse bit. ******************* RETRIEVEWINDOW address Retrieve the hidden window with this address. ******************* SCREENFLIP Push the top screen to the bottom. ******************* SCREENFORWINDOW address Get the address of the screen which contains this window. The parameter is a window address. The address is returned in 'result'. ******************* SCREENTOFRONT address Bring the screen with this address to the front. ******************* TOTAL Change the clock to display total memory. ******************* WINDOWTOBACK address Push the window with this address to the back. ******************* WINDOWTOFRONT address Bring the window with this address to the front. David Jenkins.