home *** CD-ROM | disk | FTP | other *** search
/ OS/2 Shareware BBS: 18 REXX / 18-REXX.zip / rxvim.zip / MSGSEND.CMD < prev    next >
OS/2 REXX Batch file  |  1994-11-05  |  3KB  |  123 lines

  1. /** MsgSend.cmd **/
  2. /******************************************/
  3. /*                                        */
  4. /* Command line syntax:                   */
  5. /*                                        */
  6. /* MsgSend To CC Subj Message             */
  7. /*                                        */
  8. /******************************************/
  9. ARG Send_To Send_CC Subject Message Attachment
  10. Say 'RexxVIM Send Message Program'
  11. Say
  12.  
  13. /* Unload functions upon error */
  14. SIGNAL ON ERROR NAME done
  15.  
  16. /* Load the RexxVIM extensions to Rexx */
  17. rc = RxFuncAdd('RxVIMLoadFuncs', 'REXXVIM', 'RxVIMLoadFuncs')
  18. if rc <> 0 then do
  19.    Say
  20.    Say 'RexxVIM failed to load, return code' rc
  21.    Say
  22.    Say 'Functions have been released.  Retry program.'
  23.    signal done
  24. end  /* Do */
  25. call RxVIMLoadFuncs
  26. Say
  27.  
  28.  
  29. /* Initialize the VIM subsystem */
  30. Session = ''
  31. rc = RxVIMInitialize()
  32. if (rc > 0) then call vimerr
  33.  
  34.  
  35. /* Open a session with the postoffice using the parameters */
  36. /* provided by the user                                    */
  37. Session = ''
  38. rc = RxVIMOpenSession('','','','Session')
  39. if (rc > 0) then call vimerr
  40.  
  41.  
  42. /* Create a new message of type VIM_MAIL */
  43. rc = RxVIMCreateMessage(Session,'VIM_MAIL','Message')
  44. if (rc > 0) then call vimerr
  45.  
  46.  
  47. /* Set the header text */
  48. hdrtext = subject
  49. rc = RxVIMSetMessageHeader(Message,'VIMSEL_SUBJECT', hdrtext)
  50. if (rc > 0) then call vimerr
  51.  
  52.  
  53. /* Set the priority to high */
  54. rc = RxVIMSetMessageHeader(Message,'VIMSEL_PRIORITY', 'VIM_HIGH_PRIORITY')
  55. if (rc > 0) then call vimerr
  56.  
  57.  
  58. /* Set the recipient to the user that is logged on */
  59. /* This will send the message back to ourselves    */
  60. rc = RxVIMSetMessageRecipient(Message,'VIMSEL_TO','VIMSEL_ENTITY','','',,
  61.                 Send_To,'','')
  62. if (rc > 0) then call vimerr
  63.  
  64.  
  65. /* Add some text to the message */
  66. rc = RxVIMSetMessageItem(Message,'VIMSEL_NOTE_PART','VIM_TEXT','VIMSEL_NATIVE',,
  67.          'Message Demo',MsgText,'')
  68. if (rc > 0) then call vimerr
  69.  
  70.  
  71. /* Add the config.sys as a file attachment in the message */
  72. rc = RxVIMSetMessageItem(Message,'VIMSEL_ATTACH','VIM_TEXT','VIMSEL_NATIVE',,
  73.          '','',Attachment)
  74. if (rc > 0) then call vimerr
  75.  
  76.  
  77. /* Send the message */
  78. rc = RxVIMSendMessage(Message)
  79. if (rc > 0) then call vimerr
  80.  
  81.  
  82. /* Close the session with the postoffice */
  83. rc = RxVIMCloseSession(Session)
  84. if (rc > 0) then call vimerr
  85.  
  86.  
  87. /* Terminate the active VIM subsystem connection */
  88. rc = RxVIMTerminate()
  89. if (rc > 0) then call vimerr
  90. signal done
  91.  
  92.  
  93. /***** VIMErr *******/
  94.  
  95. /* If an error occurs, this function will return the text */
  96. /* associated with the error.  Extended text may be       */
  97. /* displayed if it exists for the specified error.        */
  98.  
  99. VIMERR:
  100.  
  101. rc = RxVIMStatusText(Session,rc,'Status')
  102. Say
  103. Say '|-Error Information -----------------|'
  104.  
  105. if Status.1 = 'STATUS.1' then
  106.   Say 'Cannot obtain error status information'
  107. else do
  108.   Say '  Error Text -' Status.1
  109.   Say
  110.   Say '  Ext Status -' Status.2
  111. end
  112.  
  113. rc = RxVIMTerminate()
  114. signal done
  115.  
  116.  
  117. /* The done section will unload the RexxVIM extensions */
  118. /* and exit the program                                */
  119. DONE:
  120. /*** Drop all of the external functions ***/
  121. call RxVIMDropFuncs
  122. exit
  123.