home *** CD-ROM | disk | FTP | other *** search
/ OS/2 Shareware BBS: 35 Internet / 35-Internet.zip / ezirc12o.zip / install.zip / alias / type_it.cmd < prev   
OS/2 REXX Batch file  |  1997-12-26  |  3KB  |  86 lines

  1. /* TYPE_IT.CMD */
  2.  
  3. /* PLACEMENT: this is a ALIAS Script and should go in \ezirc\alias */
  4. /* This script will take an incoming command and type the */
  5. /* text in the file that matches the command.             */
  6. /* IE if you type /type greet, it will type the text in   */
  7. /* the file greet.txt, as if you had typed it your self.  */
  8. /* These files can contain commands like /me /join etc.   */
  9. /* But must not rely on any Parameters.                   */
  10. /* The txt files can contain multiple lines if your msg   */
  11. /* is long. Just place files with the extension of .txt   */
  12. /* in the same path as this file.                         */
  13. /* Make sure TXT files contain no blank lines after your text lines */
  14.  
  15. /* inbound message will look like                         */
  16. /* /type command                                          */
  17. /* where command it the filename part of a txt file in    */
  18. /* the same path as the type_it.cmd                       */
  19.  
  20. parse arg window cmdfile strin
  21. /* window = channel or private name, or irc server name       */
  22. /*         depending on whether the script is run from a      */
  23. /*         channel window, private window, or main window     */
  24. /* cmdfile = next parameter , filename of filename.txt        */
  25. /*           the .txt is added by the script.                 */
  26. /* str2 = third parameter, the rest of the string  (NOT USED) */
  27.  
  28. lines.0=0
  29. source='x:\alias\'||cmdfile||'.txt'
  30.  
  31.    /* open file for read */
  32.    resultCode = stream( source , 'C', 'OPEN READ')
  33.    if resultCode  \= 'READY:' then
  34.    do
  35.       say 'stream open of 'source' returned "'resultCode'"'
  36.       exit
  37.    end
  38.  
  39.    /* load each line and store in array lines */
  40.    do while lines( source )
  41.       newline = linein( source )
  42.  
  43.       /* Store lines in Array LINES */
  44.       count= lines.0 + 1
  45.       lines.0 = count
  46.       lines.count=newline
  47.    end
  48.  
  49.    /* close file */
  50.    resultCode = stream( source, 'C', 'CLOSE')
  51.    if resultCode  \= 'READY:' then
  52.    do
  53.       say 'stream close returned "'resultCode'"'
  54.       exit
  55.    end
  56.  
  57. /* construct string */
  58. linecount=lines.0
  59. counttemp= linecount - 1
  60. str = ""
  61. divider ='|'
  62. do i=1 to counttemp
  63.   Str = str||lines.i||divider
  64. end
  65.   Str = str||lines.linecount
  66.  
  67. say str
  68. return str
  69.  
  70. end:
  71. /* This TYPE_IT.CMD was written to enhance the use of EZirc I  */
  72. /* take no responsibility for how it acts on your system.  I   */
  73. /* have made every attempt to document it carefully, so that   */
  74. /* you can easily understand it.  I am not a REXX guru, I just */
  75. /* used the online help in OS/2 to find the functions that     */
  76. /* would do the things I want. I am sure there are REXX gurus  */
  77. /* out there that can probably do better. If so your welcome   */
  78. /* to do so.  This code is free for your use and modification. */
  79. /* But please do not share modified versions of this script    */
  80. /* with this notice attached.                                  */
  81. /* Have fun                                                    */
  82. /* Phillip Catt                                                */
  83. /* prcatt@netrover.com                                         */
  84. /* I am often on Efnet IRC as Number99                         */
  85.  
  86.