home *** CD-ROM | disk | FTP | other *** search
/ OS/2 Shareware BBS: 35 Internet / 35-Internet.zip / mr2i162a.zip / MSGUTIL.ORG < prev    next >
Text File  |  1997-06-16  |  6KB  |  233 lines

  1. /*
  2.     MR/2 ICE - MSGUTIL.CMD
  3.  
  4.     Copyright (c) 1996, Nick Knight
  5.     All Rights Reserved.
  6.  
  7.     Author:     Nick Knight
  8.     Created:    03/03/96
  9.     Usage:        msgutil subcommand MessageFile
  10.     Purpose:    msgutil.cmd allows for special processing of message
  11.                 files.    It is called from within MR/2 ICE, passed a
  12.                 subcommand based on the Fkey used to invoke it (F1 == 1,
  13.                 F12 = 12) and the current message file name.
  14.     US Mail:    Nick Knight, PO Box 22366, Beachwood, Ohio 44122
  15.     Fidonet:    1:157/2 or 1:/157/200
  16.     Internet:    nick@secant.com
  17.     Compuserve: 76066,1240
  18.     BBS:        Private messages on Nerd's Nook (216) 356-1772 or 1872
  19.  
  20. ** Major Update: 04/16/96, gutted/rewritten using wonderful examples by:
  21.    
  22.    Author.........:  Jason Gottschalk, Internet: os2@tir.com
  23.    Date Written...:  March 15, 1996
  24.  
  25. */
  26. /*
  27. $MENUMAP
  28.     1:Detach files using external utilities
  29.     2:Edit the file with E.EXE
  30.     3:View embedded HTML via Web Browser
  31. $END
  32. */
  33.  
  34. /* USER SELECTABLE OPTIONS */
  35.  
  36. /* if set to 0, Ctrl-F1 will NOT attempt to load viewer */
  37. EnableMimeViewers = 1       
  38.  
  39. Editor = 'e'
  40. Browser = 'netscape.exe'
  41. BitmapViewer = 'ib.exe'
  42. AviViewer = 'vb.exe'
  43. WavPlayer = 'ab.exe'
  44. INFViewer = 'view.exe'
  45. MPGViewer = 'pmmpeg.exe'
  46.  
  47. env = 'OS2ENVIRONMENT'    /* Access environment init variables */
  48.  
  49. /**********************************************************************/
  50. /**   Parameter Section - Message Information Passed from MR/2 ICE     **/
  51. /**********************************************************************/
  52. /* The section below is COMMENTED OUT to save resources.  If you      */
  53. /* wish to use one or more of these variables, just uncomment them      */
  54. /**********************************************************************/
  55. /*
  56.  
  57. Subject     = value("MR2I.SUBJECT",,env)
  58. ReplyTo     = value("MR2I.REPLYTO",,env)
  59. To            = value("MR2I.TO",,env)
  60. From        = value("MR2I.FROM",,env)
  61. MessageID    = value("MR2I.MESSAGE-ID",,env)
  62. InReplyTo    = value("MR2I.IN-REPLY-TO",,env)
  63. Editor        = value("MR2I.EDITOR",,env)
  64. SerialNumber= value("MR2I.SERIALNUMBER",,env)
  65. Line        = value("MR2I.CURRENTLINE",,env)
  66. Column        = value("MR2I.CURRENTCOLUMN",,env)
  67.  
  68. Browser     = value("MR2I.BROWSER",,env)
  69. FTPClient    = value("MR2I.FTPCLIENT",,env)
  70. CurrentWord = value("MR2I.CURRENTWORD",,env)
  71. Account     = value("MR2I.ACCOUNT",,env)
  72. Version     = value("MR2I.VERSION",,env)
  73.  
  74. MarkedBlock = value("MR2I.CURRENTBLOCK",,env)
  75. */
  76.  
  77. /*
  78.    NOTE that if markedBlock = "@rexx$txt.tmp", then the block was
  79.    too big to pass in the environment, and it was instead saved to
  80.    the file "rexx@txt.tmp".
  81. */     
  82.  
  83. /**********************************************************************/
  84.  
  85.  
  86. Signal on Syntax        /* Setup event handlers */
  87. Signal on Halt
  88. Signal on Novalue
  89.                        
  90.                        /* Include OS/2 Rexx utilities */
  91.  
  92. if RxFuncQuery('SysLoadFuncs') then
  93.    do
  94.       call RxFuncAdd 'SysLoadFuncs', 'RexxUtil', 'SysLoadFuncs'
  95.       call SysLoadFuncs
  96.    end
  97.  
  98.  
  99.                            /* Run through some standard setup */
  100.  
  101. '@echo off'               /* turn off display of OS/2 commands */
  102. crlf='0d0a'x              /* Set Carriage Return with LineFeed */
  103.  
  104.  
  105. parse value SysCurPos() with row col   /* Get current cursor position */
  106.  
  107. CMDLineArgs = translate(arg(1))        /* Snag everything from the command line */
  108.  
  109. esc  = '1b'x    /* ESC character */
  110. P = esc'[35m'   /* ANSI.SYS-control for purple foreground */
  111. r = esc'[31m'   /* ANSI.SYS-control for red foreground */
  112. g = esc'[32m'   /* ANSI.SYS-control for green foreground */
  113. y = esc'[33m'   /* ANSI.SYS-control for yellow foreground */
  114. cy = esc'[36m'  /* ANSI.SYS-control for cyan foreground */
  115. wh = esc'[0m'   /* ANSI.SYS-control for resetting attributes to normal */
  116. bl = esc'[5m'   /* ANSI.SYS-control for blinking */
  117. hl = esc'[1m'   /* ANSI.SYS-control for highlight */
  118.  
  119.  
  120. FKey = 0
  121.  
  122. parse value CMDLineArgs with FKey filename
  123.  
  124. select
  125.   when FKey = 1 then
  126.   do
  127.    'mkdir attached 2>nul'
  128.    'cd attached'
  129.    'munpack 'filename
  130.    'xbin 'filename
  131.     if (EnableMimeViewers = 1) then
  132.       do while Lines(Filename) > 0
  133.         InRec = LineIn(Filename)
  134.         If pos('FILENAME="',translate(InRec)) > 0 then
  135.           do
  136.             do while left(translate(InRec),10) <> 'FILENAME="'
  137.                InRec = strip(InRec,'L',left(InRec,1))
  138.             end
  139.             parse value InRec with file '"' DFile '"'
  140.             DFile = translate(DFile)
  141.             parse value DFile with Name '.' Ext
  142.             if ext = 'TXT' | ext = 'DOC' | ext = 'ME' then
  143.                 'start 'Editor' 'dfile
  144.             if ext = 'GIF' | ext = 'JPG' | ext = 'BMP' | ext = 'TIF' then
  145.                 'start 'BitmapViewer' 'dfile
  146.             if ext = 'MPG' then 'start 'MPGViewer' 'dfile
  147.             if ext = 'AVI' then 'start 'AviViewer' 'dfile
  148.             if ext = 'WAV' then 'start 'WavPlayer' 'dfile
  149.             if ext = 'INF' then 'start 'INFViewer' 'dfile
  150.             'cd..'
  151.             'exit'
  152.           end
  153.         end
  154.        'cd ..'
  155.   end
  156.   
  157.   when FKey = 2 then
  158.   do
  159.     'start 'Editor' 'filename
  160.   end
  161.  
  162.   when FKey = 3 then
  163.   do
  164.     call SysFileDelete('mail.htm')
  165.     'copy 'filename' mail.htm 1>nul 2>nul'
  166.     'start 'Browser' file:///mail.htm'
  167.   end
  168.   
  169.   when FKey = 4 then
  170.   do
  171.     nop
  172.   end
  173.   
  174.   when FKey = 5 then
  175.   do
  176.     nop
  177.   end
  178.   when FKey = 6 then
  179.   do
  180.     nop
  181.   end
  182.   when FKey = 7 then
  183.   do
  184.     nop
  185.   end
  186.   when FKey = 8 then
  187.   do
  188.     nop
  189.   end
  190.   when FKey = 10 then
  191.   do
  192.     nop
  193.   end
  194.   when FKey = 11 then
  195.   do
  196.     nop
  197.   end
  198.   when FKey = 12 then
  199.   do
  200.     nop
  201.   end
  202.  
  203.   otherwise
  204.     say 'Invalid Function Key passed by MR/2: 'FKey
  205. end
  206.  
  207. exit
  208. Syntax:
  209.    Say 'A SYNTAX condition was raised on line' sigl'!'
  210.    Say '  The error number is' rc', which means "'Errortext(rc)'"'
  211.    problem_line = sigl
  212.    Signal Abnormal_End
  213.  
  214. Halt:
  215.    Say 'A Halt condition was raised on line' sigl'!'
  216.    problem_line = sigl
  217.    Signal Abnormal_End
  218.  
  219. Novalue:
  220.    Say 'Novalue Condition raised on line' sigl'!'
  221.    Say '  The variable which caused it is' Condition('Description')
  222.    problem_line = sigl
  223.    Signal Abnormal_End
  224.  
  225. Abnormal_End:
  226.    Say '  That line is "'Sourceline(problem_line)'"'
  227.    Say '  You can now debug if you want to.'
  228.    Trace ?R
  229.    Nop
  230.  
  231. Exit
  232.  
  233.