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

  1. /* HTML-Helper Arexx script for Final Writer
  2.  * Ver      : 1.2 (7th January 1996)
  3.  * Author   : Paul Kolenbrander (paul@serena.iaehv.nl)
  4.  * Function : Pass on the HTML commands from HTML-Heaven to Final Writer.
  5.  * Input    : HTMLCMD - The HTML command to be inserted.
  6. */
  7.  
  8. OPTIONS RESULTS                                  /* enable return codes      */
  9. OPTIONS FAILAT 11                                /* Needed for block detect  */
  10. PARSE ARG MYCMD HTMLCMD
  11. HTMLCMD = SUBSTR(HTMLCMD,2, LENGTH(HTMLCMD)-1)   /* strip leading space      */
  12.  
  13. ADDRESS 'FINALW.1'                               /* Default, edit if needed  */
  14.  
  15. TextTool                                         /* Make sure we're in text  */
  16.  
  17. HTMLCMD = SUBSTR(HTMLCMD,2, LENGTH(HTMLCMD)-2)   /*strip leading/trailing "  */
  18.  
  19. TagColor = Blue                                  /* Default tag color  Blue  */ 
  20. TekstColor = Black                               /* Default text color Black */
  21. PairColor = Magenta                              /* Default pair tag Magenta */
  22. Status FontColor                                 /* Get the textcolor and do */
  23. Parse VAR Result TekstColor                      /* check if it's not blue   */
  24. IF UPPER(TekstColor) = 'BLUE' THEN DO
  25.    TagColor = Red                                /* if text = blue, tag = red*/
  26. END
  27. IF UPPER(TekstColor) = 'MAGENTA' THEN DO
  28.    PairColor = Red                               /* if text = blue, pair= red*/
  29. END
  30.  
  31. Status LinePos
  32. Parse VAR Result BeginLine BeginPosition EndLine EndPosition
  33.  
  34. IF (WORDS(Result) = 4) THEN DO
  35.    IF POS('><',HTMLCMD) ~= 0 THEN DO             /* Is it a split command?   */
  36.                                                  /* If yes, then....         */
  37.  
  38.       CMD2 = right(HTMLCMD,(LENGTH(HTMLCMD)-(LASTPOS('<',HTMLCMD))+1))
  39.       CMD1 = substr(HTMLCMD,1,(LENGTH(HTMLCMD)-LENGTH(CMD2)))
  40.       MoveToLine BeginLine BeginPosition          /* Move to beginning       */
  41.       FontColor PairColor
  42.       Type CMD1                                   /* Insert begin TAG        */
  43.       FontColor TekstColor
  44.       MoveToLine EndLine EndPosition+LENGTH(CMD1) /* Move to end             */
  45.       FontColor PairColor
  46.       Type CMD2                                   /* Insert end TAG          */
  47.       FontColor TekstColor
  48.    END  
  49.    ELSE DO
  50.       MoveToLine BeginLine BeginPosition          /* Move to beginning       */
  51.       FontColor TagColor
  52.       Type HTMLCMD                                /* Insert TAG              */
  53.       FontColor TekstColor
  54.    END
  55. END
  56. else DO
  57.    FontColor TagColor
  58.    Type HTMLCMD                                   /* Insert at current pos   */
  59.    FontColor TekstColor
  60. END
  61.  
  62. IF MYCMD = 'SAVE' THEN DO                         /* If AutoView On, then get*/
  63.    Status Pathname                                /* the name of the file and*/
  64.    Parse VAR bestand                              /* Save it as an ASCII file*/
  65.    Save ASCII bestand
  66.    IF bestand = '' THEN DO                        /* Display it in a browser */
  67.       ADDRESS COMMAND 'rx S:HTMLVIEW.rexx'
  68.    END
  69.    ELSE DO
  70.       ADDRESS COMMAND 'rx S:HTMLVIEW.rexx '||bestand
  71.    END
  72. END
  73.  
  74. EXIT                                              /* And exit the script.    */
  75.