home *** CD-ROM | disk | FTP | other *** search
/ The AGA Experience 2 / agavol2.iso / software / utilities / comms / html-heaven / arexx / html-write.rexx < prev    next >
OS/2 REXX Batch file  |  1996-01-08  |  2KB  |  63 lines

  1. /* HTML-Helper Arexx script for Write
  2.  * Ver      : 1.1 (7th January 1996)
  3.  * Copyright: Paul Kolenbrander (InterNet: paul@serena.iaehv.nl)
  4.  * Function : Pass on the HTML commands from HTML-Helper to Write.
  5.  *            Detect if block is selected and if so drape tag pairs
  6.  *            around the block and then deselect it.
  7.  * Input    : HTMLCMD - The HTML command to be inserted.
  8. */
  9.  
  10. OPTIONS RESULTS                             /* enable return codes       */
  11. PARSE ARG MYCMD HTMLCMD
  12. HTMLCMD = SUBSTR(HTMLCMD,2, LENGTH(HTMLCMD)-1) /* strip leading space    */
  13.  
  14. /* HTMLCMD = STRIP((TRANSLATE(HTMLCMD,'','\')), B,'"') */
  15.                                             /* Strip quotes at each end. */
  16.  
  17. ADDRESS "WRITE"                             /* Default, edit if needed   */ 
  18.  
  19. 'GetVar (_Marked)'                          /* Check if block is defined */
  20. Blok = Result
  21. IF Blok = 2 THEN DO              
  22.                                             /* A block is defined        */
  23.    'GetVar (_MarkAy)'
  24.    BeginLine = Result                       /* Now get the block coords. */
  25.    'GetVar (_MarkAx)'
  26.    BeginCol  = Result
  27.    'GetVar (_MarkBy)'
  28.    EndLine   = Result
  29.    'GetVar (_MarkBx)'
  30.    EndCol    = Result
  31.    IF POS('><',HTMLCMD) ~= 0 THEN DO        /* Is it a split command?    */
  32.                                             /* If yes, then....          */
  33.       CMD2 = right(HTMLCMD,(LENGTH(HTMLCMD)-(LASTPOS('<',HTMLCMD))+1))
  34.       CMD1 = substr(HTMLCMD,1,(LENGTH(HTMLCMD)-LENGTH(CMD2)))
  35.       CMD1 = CMD1||'"'
  36.       CMD2 = '"'||CMD2
  37.       say CMD1 CMD2
  38.       'GOTO' EndCol EndLine                 /* Move to end and put 2nd   */
  39.       'WriteText' CMD2
  40.       'GOTO' BeginCol BeginLine             /* Move to start and put 1st */
  41.       'WriteText' CMD1
  42.     END
  43.     ELSE DO
  44.       'WriteText' HTMLCMD                   /* Insert at current pos.    */
  45.     END
  46. END
  47. ELSE DO
  48.     'WriteText' HTMLCMD                     /* Insert at current pos.    */
  49. END
  50.  
  51. IF MYCMD = 'SAVE' THEN DO
  52.    'Save _FileName'
  53.    'GetVar (_FileName)'
  54.    IF RESULT = -1 THEN DO
  55.       ADDRESS COMMAND 'rx S:HTMLVIEW.rexx'
  56.    END
  57.    ELSE DO
  58.       ADDRESS COMMAND 'rx S:HTMLVIEW.rexx '||RESULT
  59.    END
  60. END
  61.  
  62. EXIT                                        /* And exit the script.      */
  63.