Automatic Save Utility
by Andrew Hersee

This program is designed to automatically save files from Wimp applications at regular intervals.

When run, the program reads in the data file !AutoSave.Data, and adds an icon to the left-hand side of the icon bar. Clicking Menu over this icon displays a menu containing two options. Auto Save toggles the automatic saving on and off, while Quit terminates the program.

Every ten seconds the program finds out which window contains the caret. It checks that the document is titled, and that the title ends in an asterisk, by convention indicating whether the document has been modified. (Note: this is not absolutely reliable, as other things can come after the asterisk.)

If the document has been modified, and the amount of time specified in the data file has elapsed since it was last saved, the program checks that the application which owns the caret is listed in the data file. If it is, the program sends the two characters listed in the data file to the application which owns the caret, causing the file to be saved.

If the first character specified in the data file is zero, the application displays an error box warning the user to save the document. This is useful for applications such as Draw, which do not have a keystroke short cut. If the second character is zero, the first character is still sent, so for instance sending F3 then 0 to Edit will result in the 'Save as:' dialogue box being displayed, but the file not being saved.

Clicking Select over the icon bar icon causes the document containing the caret to be saved immediately.

Note: As modified documents are saved under the same name as the original, it is advised not to use this facility should it be required to revert to the original file at any time.
