home *** CD-ROM | disk | FTP | other *** search
/ OS/2 Shareware BBS: 35 Internet / 35-Internet.zip / namchang.zip / namchang.cmd next >
OS/2 REXX Batch file  |  1997-05-09  |  2KB  |  54 lines

  1. /* apply to outgoing mail from msgutil to change the "From" and the sig */
  2. /* */
  3. /* based on code from William H. Geiger III */
  4. /* whgiii@amaranth.com */
  5.  
  6. /* usage:  1.  Edit the lines to reflect the changes you want to make 
  7.            It changes the "From:" line in the header to what you set
  8.        "newfrom" to [be careful not to mismatch quotes here!]
  9.        and one line in the message (presumably in the sig)
  10.        which must match exactly the contents of oldsig;
  11.        this line will be changed to newsig.
  12.        To bypass this test set oldsig= ""
  13.        2.  Edit msgutil.cmd (in the mr2ice directory) to have
  14.        an unused Ctrl-Fkey invoke this cmd file as follows:
  15.        call "namechang" filename
  16.        3.  To use, when composing a message, press Ctrl and the
  17.        selected Fkey.
  18.        */
  19.  
  20. /* edit these three lines to reflect the changes you want to make */
  21. newfrom='From: "Mary Jane Thomas" <jt@epix.net>'
  22. oldsig= " Julian Thomas (and/or if appropriate, Mary Jane Thomas)"
  23. newsig=" Mary Jane Thomas"
  24. /*  you shouldn't need to edit anything after this */
  25. parse arg msg_filename .
  26. '@echo off'
  27. blank=''
  28. from="From:"
  29. outfilename="namchang.tmp"
  30.  
  31. nxy=1
  32. nxz=stream(outfilename,'c','open write')
  33. nzz=stream(msg_filename,'c','open read')
  34. do forever while (length(linein(msg_filename))>0) /* pull file header */
  35. nxx=stream(msg_filename,'c','seek +0')            /* get read pointer */
  36. nxx_rs=stream(msg_filename,'c','seek =' nxy)      /* reset read pointer */
  37. lin=linein(msg_filename)
  38.    /* test to see if we change the FROM */
  39. if pos(from,lin)=1 then lo=lineout(outfilename,newfrom)
  40.    else lo=lineout(outfilename,lin)
  41. nxy=stream(msg_filename,'c','seek +0')
  42. end
  43. lo=lineout(outfilename,blank)
  44. do forever while lines(msg_filename)
  45.    lin=linein(msg_filename)
  46.    if (lin=oldsig) & (oldsig<>"") then lo=lineout(outfilename,newsig)
  47.      else lo=lineout(outfilename,lin)
  48.    end
  49. st1=stream(msg_filename,'c','close')
  50. st3=stream(outfilename,'c','close')
  51. 'erase' msg_filename
  52. 'rename' outfilename msg_filename
  53. exit
  54.