home *** CD-ROM | disk | FTP | other *** search
- /*
- MR/2 ICE - MSGUTIL.CMD
-
- Copyright (c) 1996, Nick Knight
- All Rights Reserved.
-
- Author: Nick Knight
- Created: 03/03/96
- Usage: msgutil subcommand MessageFile
- Purpose: msgutil.cmd allows for special processing of message
- files. It is called from within MR/2 ICE, passed a
- subcommand based on the Fkey used to invoke it (F1 == 1,
- F12 = 12) and the current message file name.
- US Mail: Nick Knight, PO Box 22366, Beachwood, Ohio 44122
- Fidonet: 1:157/2 or 1:/157/200
- Internet: nick@secant.com
- Compuserve: 76066,1240
- BBS: Private messages on Nerd's Nook (216) 356-1772 or 1872
-
- ** Major Update: 04/16/96, gutted/rewritten using wonderful examples by:
-
- Author.........: Jason Gottschalk, Internet: os2@tir.com
- Date Written...: March 15, 1996
-
- */
-
- /* USER SELECTABLE OPTIONS */
-
- /* if set to 0, Ctrl-F1 will NOT attempt to load viewer */
- EnableMimeViewers = 1
-
- Editor = 'e'
- Browser = 'explore.exe'
- BitmapViewer = 'ib.exe'
- AviViewer = 'vb.exe'
- WavPlayer = 'ab.exe'
- INFViewer = 'view.exe'
- MPGViewer = 'pmmpeg.exe'
-
-
- Signal on Syntax /* Setup event handlers */
- Signal on Halt
- Signal on Novalue
-
- /* Include OS/2 Rexx utilities */
-
- if RxFuncQuery('SysLoadFuncs') then
- do
- call RxFuncAdd 'SysLoadFuncs', 'RexxUtil', 'SysLoadFuncs'
- call SysLoadFuncs
- end
-
-
- /* Run through some standard setup */
-
- '@echo off' /* turn off display of OS/2 commands */
- crlf='0d0a'x /* Set Carriage Return with LineFeed */
-
- env = 'OS2ENVIRONMENT' /* Access environment init variables */
-
- parse value SysCurPos() with row col /* Get current cursor position */
-
- CMDLineArgs = translate(arg(1)) /* Snag everything from the command line */
-
- esc = '1b'x /* ESC character */
- P = esc'[35m' /* ANSI.SYS-control for purple foreground */
- r = esc'[31m' /* ANSI.SYS-control for red foreground */
- g = esc'[32m' /* ANSI.SYS-control for green foreground */
- y = esc'[33m' /* ANSI.SYS-control for yellow foreground */
- cy = esc'[36m' /* ANSI.SYS-control for cyan foreground */
- wh = esc'[0m' /* ANSI.SYS-control for resetting attributes to normal */
- bl = esc'[5m' /* ANSI.SYS-control for blinking */
- hl = esc'[1m' /* ANSI.SYS-control for highlight */
-
-
- FKey = 0
-
- parse value CMDLineArgs with FKey filename
-
- select
- when FKey = 1 then
- do
- 'mkdir attached 2>nul'
- 'cd attached'
- 'munpack 'filename
- 'xbin 'filename
- if (EnableMimeViewers = 1) then
- do while Lines(Filename) > 0
- InRec = LineIn(Filename)
- If pos('FILENAME="',translate(InRec)) > 0 then
- do
- do while left(translate(InRec),10) <> 'FILENAME="'
- InRec = strip(InRec,'L',left(InRec,1))
- end
- parse value InRec with file '"' DFile '"'
- DFile = translate(DFile)
- parse value DFile with Name '.' Ext
- if ext = 'TXT' | ext = 'DOC' | ext = 'ME' then
- 'start 'Editor' 'dfile
- if ext = 'GIF' | ext = 'JPG' | ext = 'BMP' | ext = 'TIF' then
- 'start 'BitmapViewer' 'dfile
- if ext = 'MPG' then 'start 'MPGViewer' 'dfile
- if ext = 'AVI' then 'start 'AviViewer' 'dfile
- if ext = 'WAV' then 'start 'WavPlayer' 'dfile
- if ext = 'INF' then 'start 'INFViewer' 'dfile
- 'cd..'
- 'exit'
- end
- end
- 'cd ..'
- end
-
- when FKey = 2 then
- do
- 'start 'Editor' 'filename
- end
-
- when FKey = 3 then
- do
- call SysFileDelete('mail.htm')
- 'copy 'filename' mail.htm >12'
- 'start 'Browser' mail.htm'
- end
-
- when FKey = 4 then
- do
- nop
- end
-
- when FKey = 5 then
- do
- nop
- end
- when FKey = 6 then
- do
- nop
- end
- when FKey = 7 then
- do
- nop
- end
- when FKey = 8 then
- do
- nop
- end
- when FKey = 10 then
- do
- nop
- end
- when FKey = 11 then
- do
- nop
- end
- when FKey = 12 then
- do
- nop
- end
-
- otherwise
- say 'Invalid Function Key passed by MR/2: 'FKey
- end
-
- exit
- Syntax:
- Say 'A SYNTAX condition was raised on line' sigl'!'
- Say ' The error number is' rc', which means "'Errortext(rc)'"'
- problem_line = sigl
- Signal Abnormal_End
-
- Halt:
- Say 'A Halt condition was raised on line' sigl'!'
- problem_line = sigl
- Signal Abnormal_End
-
- Novalue:
- Say 'Novalue Condition raised on line' sigl'!'
- Say ' The variable which caused it is' Condition('Description')
- problem_line = sigl
- Signal Abnormal_End
-
- Abnormal_End:
- Say ' That line is "'Sourceline(problem_line)'"'
- Say ' You can now debug if you want to.'
- Trace ?R
- Nop
-
- Exit
-
-