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

  1. /** NtsMsg.cmd **/
  2. /******************************************/
  3. /*                                        */
  4. /* Command line syntax:                   */
  5. /*                                        */
  6. /* NtsMsg user_name                       */
  7. /*                                        */
  8. /*                                        */
  9. /******************************************/
  10. ARG user_name
  11. '@echo off'
  12. '@cls'
  13. Say 'RexxVIM Message Demonstration Program'
  14. Say 'for Lotus Notes'
  15. Say
  16.  
  17. /* Unload functions upon error */
  18. SIGNAL ON ERROR NAME done
  19.  
  20. /* Prompt for the parameters if not passed on the */
  21. /* command line                                   */
  22. if LENGTH(STRIP(user_name)) = 0 then do
  23.    user_name = ''
  24.    Say 'Send Message To -'
  25.    PARSE PULL user_name
  26. end  /* Do */
  27.  
  28.  
  29. /* Load the RexxVIM extensions to Rexx */
  30. rc = RxFuncAdd('RxVIMLoadFuncs', 'REXXVIM', 'RxVIMLoadFuncs')
  31. if rc <> 0 then do
  32.    Say
  33.    Say 'RexxVIM failed to load, return code' rc
  34.    Say
  35.    Say 'Functions have been released.  Retry program.'
  36.    signal done
  37. end  /* Do */
  38. call RxVIMLoadFuncs
  39. Say 'Functions are now loaded'
  40. Say
  41.  
  42.  
  43. /* Initialize the VIM subsystem */
  44. Session = ''
  45. rc = RxVIMInitialize()
  46. Say
  47. Say '|-Call To Routine -------------------------RC--|'
  48. Say '  RxVIMInitialize -              ' RxVIMStatus(rc)
  49. if (rc > 0) then call vimerr
  50.  
  51.  
  52. /* Open a session with the postoffice using the parameters */
  53. /* provided by the user                                    */
  54. Session = ''
  55. rc = RxVIMOpenSession('','','','Session')
  56. Say '  RxVIMOpenSession -             ' RxVIMStatus(rc)
  57. if (rc > 0) then call vimerr
  58.  
  59.  
  60. /* Create a new message of type VIM_MAIL */
  61. rc = RxVIMCreateMessage(Session,'VIM_MAIL','Message')
  62. Say '  RxVIMCreateMessage -           ' RxVIMStatus(rc)
  63. if (rc > 0) then call vimerr
  64.  
  65.  
  66. /* Set the header text */
  67. hdrtext = user_name"'s config.sys file"
  68. rc = RxVIMSetMessageHeader(Message,'VIMSEL_SUBJECT', hdrtext)
  69. Say '  RxVIMSetMessageHeader -        ' RxVIMStatus(rc)
  70. if (rc > 0) then call vimerr
  71.  
  72.  
  73. /* Set the recipient to the user that is logged on */
  74. /* This will send the message back to ourselves    */
  75. rc = RxVIMSetMessageRecipient(Message,'VIMSEL_TO','VIMSEL_UNKNOWN_RECIP_TYPE','VIMSEL_NATIVE','',,
  76.                 user_name,'','')
  77. Say '  RxVIMSetMessageRecipient -     ' RxVIMStatus(rc)
  78. if (rc > 0) then call vimerr
  79.  
  80.  
  81. /* Add some text to the message */
  82. itemtxt = 'This message was created using the VIM Toolkit for Rexx!!'
  83. rc = RxVIMSetMessageItem(Message,'VIMSEL_NOTE_PART','VIM_TEXT','',,
  84.          'Message Demo',itemtxt,'')
  85. Say '  RxVIMSetMessageItem -          ' RxVIMStatus(rc)
  86. if (rc > 0) then call vimerr
  87.  
  88.  
  89. /* Send the message */
  90. rc = RxVIMSendMessage(Message)
  91. Say '  RxVIMSendMessage -             ' RxVIMStatus(rc)
  92. if (rc > 0) then call vimerr
  93.  
  94.  
  95. /* Close the session with the postoffice */
  96. rc = RxVIMCloseSession(Session)
  97. Say '  RxVIMCloseSession -            ' RxVIMStatus(rc)
  98. if (rc > 0) then call vimerr
  99.  
  100.  
  101. /* Terminate the active VIM subsystem connection */
  102. rc = RxVIMTerminate()
  103. Say '  RxVIMTerminate -               ' RxVIMStatus(rc)
  104. if (rc > 0) then call vimerr
  105. signal done
  106.  
  107.  
  108. /***** VIMErr *******/
  109.  
  110. /* If an error occurs, this function will return the text */
  111. /* associated with the error.  Extended text may be       */
  112. /* displayed if it exists for the specified error.        */
  113.  
  114. VIMERR:
  115.  
  116. rc = RxVIMStatusText(Session,rc,'Status')
  117. Say
  118. Say '|-Error Information ---------------------------|'
  119.  
  120. if Status.1 = 'STATUS.1' then
  121.   Say 'Cannot obtain error status information'
  122. else do
  123.   Say '  Error Text -' Status.1
  124.   Say
  125.   Say '  Ext Status -' Status.2
  126. end
  127.  
  128. rc = RxVIMTerminate()
  129. signal done
  130.  
  131.  
  132. /* The done section will unload the RexxVIM extensions */
  133. /* and exit the program                                */
  134. DONE:
  135. /*** Drop all of the external functions ***/
  136. call RxVIMDropFuncs
  137. Say '|----------------------------------------------|'
  138. Say 'Demo Complete.  All functions released'
  139. 'pause'
  140. exit
  141.