home *** CD-ROM | disk | FTP | other *** search
- /* AddEvent.tlog -- inserts an event into the NAG scheduler from tlog */
- /* Use this as a template for adding "events" to you own scheduler. */
- /* tlog is a athelete's training diary by E. F. Bacon */
-
- /* The basis for this script comes from ... */
- /* addnag.rexx - inserts requestored NAGPLUS event into current nag-year */
-
- /* copyright 1989 Richard Lee Stockton and Gramma Software. */
- /* This code is freely distributable as long as this copyright */
- /* notice remains, unchanged, at the start of the code. Thank you. */
-
-
- OPTIONS RESULTS
- SIGNAL ON BREAK_C
-
- /* add the necessary libraries */
- IF(~EXISTS("libs:rexxsupport.library")|~EXISTS("libs:rexxarplib.library")) THEN
- DO
- SAY "Couldn't find needed library (rexxsupport and/or rexxarplib)."
- EXIT 20
- END
- CALL ADDLIB('rexxsupport.library',0,-30,0)
- CALL ADDLIB('rexxarplib.library',0,-30,0)
-
-
- return_text = "0"
- priport = ""
- success = 0
-
- address 'TLOG'
-
- /* Get the CurrentDate from the Tlog Calendar; the ISO dateformat (1) */
- /* works well with NAG. Your scheduler may like a different format. */
- getdateformat
- oldformat = result
- dateformat 1
- currentdate
- datestring = result
- dateformat oldformat
-
- /* NAG specific variables to set port and prompt. nagfront is fragment */
- /* of NAG specific way to schedule an event from its AREXX port; it gets */
- /* appended below. */
- nagport = 'NagRexx1'
- nagfront = SUBSTR(datestring,3,4)
-
- nagprompt = ""
- /* To use the last known, prompt remove the comments from the next line */
- /* nagprompt = GETCLIP('nag_event') */
-
- /* Form nag prompt from the tlog currentdate and the nag_event !ACTION! */
- /* with 1 voice and sound nag. */
- /* NAG allows you to define your own events a better one might be RACE! */
- /* Another improvement is to add the datestring to the nagevent. NAG has*/
- /* a feature that when a token is selected from the event text, a text */
- /* editor is invoked. Thus if NOTEDIR and NOTEEXT of tlog match the NAG*/
- /* equivalents, you can link a diary entry to tlog and to your scheduler*/
- /* However, see the note about the "11 char test" below. */
-
- IF nagprompt=="" THEN nagprompt=nagfront"0000ZI"
-
-
- /* Where the 'pretty' stuff gets done. 'nagevent' is text to insert */
-
- CALL SCREENTOFRONT()
-
- nagevent = Request(50,50,,
- " ADD an Event to NAGPLUS\\
- MM=Month, DD=Day, HH=Hours, NN=miNutes, ZI=sound/voice nag\\
- MMDDHHNNZIYour event text (up to 48 characters) goes here.",,
- nagprompt,"ADD","CANCEL")
-
- CALL SCREENTOBACK()
-
- /* if the text less than 11 chars (no event text), quietly return */
- /* otherwise, insert in NAGPLUS, (assuming I can find it) */
- /* N.B. the 11 chars test is nagprompt dependent you may have to change */
- /* this if clause */
- IF LENGTH(nagevent)>10 THEN
- DO
- ADDRESS VALUE nagport
- lock
- priport = RESULT
- IF(priport~="" & priport~="RESULT") THEN
- DO
- ADDRESS VALUE priport
- IF LENGTH(nagevent)>59 THEN nagevent=LEFT(nagevent,59)
- set 4 /* set to this year */
- edit nagevent
- unlock
- IF ~SETCLIP('nag_event',nagevent) THEN return_text = "CLIP_FAILURE"
- END
- ELSE return_text = "PORT_LOCK_FAILURE"
- END
-
- EXIT return_text
-
-
- BREAK_C:
-
- IF SHOWLIST(p,priport) THEN unlock
- EXIT 'ABORT'
-