home *** CD-ROM | disk | FTP | other *** search
- ; RBcomm macro examples
- ;
- ; by Ralf Brown
-
- ;---------------------------------------------------------------
- ; beep every half hour
- ; continues until another macro file loaded or some other binding
- ; issues a CANCEL_DELAYED ALL
- ;
- ; first, define #199 to have the name HalfHourBeep
- #defkey HalfHourBeep 199
-
- F2 DELAYED 1800
- CALL HalfHourBeep ; 200-255 are reserved
-
- HalfHourBeep MULTI
- BEEP
- DELAYED 1800
- CALL #199 ; note: same as HalfHourBeep
- END
-
- ; I have been asked "why CALL instead of PUSHKEY?" and "why doesn't the second
- ; CALL cause some kind of infinite loop?"
- ;
- ; The difference between PUSHKEY and CALL is that PUSHKEY #199 will not cause
- ; the #199 macro to execute until the next time RBcomm reads the keyboard at
- ; the terminal emulation level (it would be discarded by the line-input
- ; function, for example). The CALL executes immediately and then continues
- ; execution with the next line of the macro (if any). As written, the 'beep
- ; every half hour' macro will cause a beep even if currently executing another
- ; macro; with PUSHKEY, the beep would not occur until the current macro
- ; completes--unless the macro is/will execute a command which takes input, in
- ; which case the #199 will be lost, ending the repetition. You don't get an
- ; infinite nesting because the DELAYED command simply stores a pointer and the
- ; desired time, then exits. Thus, the macro works something like this:
- ;
- ; create an event for CALL #199
- ; exit F2
- ; ...
- ; time to wake up and execute the CALL #199
- ; BEEP
- ; create an event for CALL #199
- ; exit #199
- ; exit CALL #199
- ; ...
- ; time to wake up again and execute the CALL #199
- ; BEEP
- ; create an event for CALL #199
- ; exit #199
- ; exit CALL #199
- ; ...
- ; time to wake up again and execute the CALL #199
- ; etc.
- ;
- ; As you can see, at any given time, there is at most one pending event and one
- ; invocation of #199.
-
- ;---------------------------------------------------------------
- ; display a time-limited message without DESQview message-box
- ; note: should be on top-most row to avoid a mess if screen scrolls during
- ; wait interval
- ;
- F3 MULTI
- MESSAGE 0 50 "^[[0;5mTimed test message"
- DELAYED 3
- MESSAGE 0 50 " " ; same length as orig message
- END
-
- ;---------------------------------------------------------------
- ; repeatedly try to elicit a response from the remote system
- ; abort after ten minutes of no response
- ;
- F4 MULTI
- DELAYED 600
- ABORT_UNTIL ; give up after ten minutes
- UNTIL SUCCESS
- {
- TEXT "\r"
- WAITFOR 2 "login:"
- }
- CANCEL_DELAYED LAST ; no more need for the timed abort
- END
-
- ;---------------------------------------------------------------
- ; notify user of any incoming calls (only for DESQview and Hayes-comp modems)
- ;
- OnLoad WHEN 0 "RING^M"
- NOTIFY "Phone is ringing"
-
- ;---------------------------------------------------------------
- ; add the standard bindings which have not been overridden
- #include "rbcomm"
-