home *** CD-ROM | disk | FTP | other *** search
/ Club Amiga de Montreal - CAM / CAM_CD_1.iso / files / 579a.lha / Textra_v1.11 / Scripts / eval.textra next >
Text File  |  1991-08-28  |  1KB  |  43 lines

  1.     /*******************************************************************
  2.      *   TEXTRA AREXX script -- Mike Haas, 1991, All Rights Reserved.  *
  3.      * Freely distributable ONLY as a component of the TEXTRA package. *
  4.      * This banner may not be removed or altered (improvements to the  *
  5.      *    actual program welcome).  Please document and send to me.    *
  6.      *        !!! PLACE THIS FILE IN YOUR REXX: DIRECTORY !!!          *
  7.      *******************************************************************/
  8.  
  9.             /***   Thanks (ONCE AGAIN) to Dr. Martin Kees   ***/
  10.  
  11. /* evaluate a selected (pure math) expression */
  12.  
  13. /* TO USE...
  14.  
  15.    Select the text that comprises the mathematical expression (even
  16.    if it spans several lines).  Then launch this script.
  17.    
  18.    TEXTRA will tell you the answer!
  19.    
  20.    For example, double-click on this -->  4*2.1
  21.    and then execute this script.
  22.    
  23. */
  24.  
  25. options results
  26.  
  27. expression= 'EX= '
  28. get select text
  29. parse var result num  thisselect
  30. if num='NO' then exit
  31.  
  32. expression= expression thisselect
  33.  
  34. do until num=0
  35.    get select next
  36.    parse var result num thisselect
  37.    expression= expression thisselect
  38.    end
  39.  
  40. interpret expression
  41. val= "The value is: " ex
  42. notify '"' val '"'
  43.