home *** CD-ROM | disk | FTP | other *** search
/ OS/2 Shareware BBS: 35 Internet / 35-Internet.zip / adrum2ns.zip / ADRUM2NS.CMD next >
OS/2 REXX Batch file  |  1996-12-21  |  3KB  |  70 lines

  1. /* -------------------------------- REXX --------------------------- */
  2. /* 96-12-20 or convert Umail addressbook to Netscape 2.02            */
  3. /* ----------------------------------------------------------------- */
  4.    say
  5.    say 'ADRUM2NS 1996-12-21'
  6.  
  7.    ofile='address.htm'
  8. /* ----------------------------------------------------------------- */
  9.    parse upper arg ifile ofi rest
  10.    if left(ifile,1)='"' then do
  11.                                ifile=ifile ofi
  12.                                ofi  =rest
  13.                                end
  14.    if ifile = ''       then                                   exit 0
  15.    if ofi  \= ''       then ofile=ofi
  16.    ifile=strip(translate(ifile,' ','"'))
  17.  
  18.    say 'converting:' ifile
  19. /* ----------------------------------------------------------------- */
  20.    j=0
  21.    o=0
  22.    call stream ifile,'c','close'
  23.    do while chars(ifile)>1
  24.      parse value linein(ifile) with type '.' rest
  25.      select
  26.        when type=':nick'   then do
  27.                                  if o then do
  28.                                    o.j='<DT><A HREF="mailto:'ui.j'@'no.j'" NICKNAME="'nn.j'">'nm.j'</A> <DD>'fo.j
  29.                                    end
  30.                                  o=1
  31.                                  j=j+1
  32.                                  nn.j=rest
  33.                                  end
  34.        when type=':name'   then do
  35.                                  nm.j=rest
  36.                                  end
  37.        when type=':userid' then do
  38.                                  ui.j=rest
  39.                                end
  40.        when type=':node'   then do
  41.                                  no.j=rest
  42.                                end
  43.        when type=':folder' then do
  44.                                  fo.j=rest
  45.                                end
  46.        otherwise               nop
  47.        end
  48.      end
  49.    call stream ifile,'c','close'
  50.    if j>0 then                     o.j='<DT><A HREF="mailto:'ui.j'@'no.j'" NICKNAME="'nn.j'">'nm.j'</A> <DD>'fo.j
  51.  
  52.    '@erase' ofile '2>NUL'
  53.    call lineout ofile,'<!DOCTYPE NETSCAPE-Addressbook-file-1> '
  54.    call lineout ofile,'<!-- This is an automatically generated file.'
  55.    call lineout ofile,'It will be read and overwritten.'
  56.    call lineout ofile,'Do Not Edit! -->'
  57.    call lineout ofile,'<TITLE>Converted Address book</TITLE>'
  58.    call lineout ofile,'<H1>Converted Address book</H1>'
  59.    call lineout ofile,'<DL><p>'
  60.    do i=1 to j
  61.      call lineout ofile,'  'o.i
  62.      end
  63.    call lineout ofile,'</DL><p>'
  64.    call stream ofile,'c','close'
  65.  
  66.    say j 'entries converted'
  67.  
  68.    'start /F e' ofile
  69. /* ----------------------------------------------------------------- */
  70.