home *** CD-ROM | disk | FTP | other *** search
- /* TrimEnd.mxe
-
- RexxEdit example ARexx macro program
-
- Removes all events after the END event.
-
- (If there are multiple END markers in the sequence, it removes all
- events after first one, including the other end events.)
- */
-
-
- options results /* always include this command */
-
- MXPOINTER "sleepy" /* show user we're working */
-
- WeFoundTheEnd = 'false' /* initialize some variables */
- EventsRemoved = 0
-
- BEGINSCAN 'all' /* begin scan of all events */
- if result ~= 0 then do forever /* 0 if error */
-
- NEXTEVENT /* get next event in sequence */
- if result == 0 then break /* 0 if no more events, break do forever */
-
- if WeFoundTheEnd == 'false' then do /* if still looking for END */
- if EVENT.TYPE == 'END' then WeFoundTheEnd = 'true' /* ah! found it */
- end
- else do
- REMEVENT /* if after END, remove it */
- EventsRemoved = EventsRemoved + 1 /* add one to removal count */
- end
-
- end /* end of do forever, do again */
- ENDSCAN /* end scan */
-
- MXPOINTER "normal" /* we're done */
-
- /* report results... */
-
- if EventsRemoved ~= 1 then MXREPORT "Removed" EventsRemoved "events."
- else MXREPORT "Removed 1 event." /* for good English */
-
- exit
-