home *** CD-ROM | disk | FTP | other *** search
Text File | 1992-11-27 | 2.4 KB | 76 lines | [TEXT/KEEN] |
- #$LogDaemon : this program is meant to be run in concurrent mode
- # only. Stop it either with <Command><period> or by copying the
- # word "quitit" in your calling application. All right, so it's
- # a new word. This program runs transparently behind the calling
- # app, waiting for "logit" to appear on the clipboard. When it
- # does, the NEXT bit of text that you copy will be appended to
- # a log file, together with a date stamp. You'll see the menu
- # bar flash to acknowledge copying "logit", and again after
- # appending your next copy to the log file. The name of the
- # log file is hard-coded in the variable "logFile" below, and
- #----------------------------------------
- # you should change the name of this file to one of your own
- #----------------------------------------
- # before running this program. Your calling app must be the
- # front application in order for this to work, since it is
- # the calling application's private clip that is monitored,
- # not the system clip.
-
- # No input or variables are required.
-
- # This sort of trigger can be used to any purpose. A slightly
- # "clumsier" approach would be to check for the existence of a file,
- # and if found then take action, and delete the file, eg
- # ....looping forever....
- # if (exists(triggerFile))
- # {
- # TakeAction()
- # remove(triggerFile)
- # }
- # -- this file-based approach does have the advantage that it can
- # be used while the calling app, and hAWK, are in the background.
- # Multiple messages can be passed to trigger alternate actions,
- # even to the point of calling specific hAWK programs via the
- # "hAWK()" function.
-
- # If you think up a use for this sort of "daemon", you can use
- # this file as a skeleton.
-
- BEGIN {
- # Change "logFile" path to a real directory on one of your disks
- # - either type it in, or use $EchoFullPathNames to retrieve the
- # name and location of an existing file.
- logFile = "Diskname:junk:Dummy log"
- while (1)
- {
- if ((newClip = getclip(7)) != oldClip)
- {
- oldClip = newClip
- if (newClip == "logit")
- {
- pending = 1
- beep(0) # 0 flashes the menu bar
- }
- else if (newClip == "quitit")
- {
- exit
- }
- else if (pending)
- {
- fullClip = getclip()
- FlogLog()
- pending = 0
- beep(0) # 0 flashes the menu bar
- }
- }
- }
- }
-
- # append the time to the log file
- function FlogLog()
- {
- print time() >> logFile
- print fullClip >> logFile
- fullClip = "" #just in case it was huge
- close(logFile)
- }