home *** CD-ROM | disk | FTP | other *** search
/ OS/2 Shareware BBS: 5 Edit / 05-Edit.zip / eeedit22.zip / enhanced.zip / Txt2Html.plg < prev    next >
Text File  |  2001-04-15  |  3KB  |  70 lines

  1. /****************************************/
  2. /* Sample for working on the content of */
  3. /* the MLE with an external program     */
  4. /*                                      */
  5. /* This sample uses Valera Veryazov's   */
  6. /* TXT2HTML.EXE to convert text from    */
  7. /* the editor into an html file         */
  8. /* and reloads it into the editor       */
  9. /*                                      */
  10. /* You MUST SET THE LOCATION of         */
  11. /* the TXT2HTML program to use this!    */
  12. /****************************************/
  13.  
  14. /****************************************/
  15. /* Set Txt2Html.cmd location. "IniDir"  */
  16. /* is always the location of the editor */
  17. /****************************************/
  18. Txt2Html=IniDir||'\Txt2Html.exe'
  19. rc=SysFileTree(Txt2Html,'List','FO')
  20. if List.0<1 then do
  21.   response=VpMessageBox(window,'ERROR!','You must set the location of Txt2Html.exe to use this plugin')
  22.   return
  23. end
  24.  
  25. /****************************************/
  26. /* Turn on the red "Working" light      */
  27. /****************************************/
  28. Call VpSetItemValue EEEmainwin,1017,rdledon
  29.  
  30. /****************************************/
  31. /* Get name of current file and set the */
  32. /* workfiles to be built beside it      */
  33. /* "FileName" is always the name of the */
  34. /* file currently loaded in the editor  */
  35. /****************************************/
  36. if FileName<>'' then parse var FileName WorkFileName '.' ext
  37. else WorkFileName=IniDir||'\Txt2Html'
  38. WorkFile=WorkFileName||'.T2H'
  39. HtmlFile=WorkFileName||'.html'
  40.  
  41. /****************************************/
  42. /* Get contents of the edit window      */
  43. /* and write them to the work file      */
  44. /****************************************/
  45. Document = VpGetItemValue(window,Target)
  46. rc=charout(WorkFile,Document)
  47. rc=Stream(WorkFile,'C','Close')
  48.  
  49. /****************************************/
  50. /* run txt2html here on WorkFile        */
  51. /* Does this need two arguments?        */
  52. /****************************************/
  53. address cmd Txt2Html WorkFile
  54.  
  55. /****************************************/
  56. /* Read the new html file and load it   */
  57. /* using the editors internal 'openfile'*/
  58. /****************************************/
  59. Call Openfile HtmlFile
  60.  
  61. /****************************************/
  62. /* Delete the workfile                  */
  63. /****************************************/
  64. rc=SysFileDelete(WorkFile)
  65.  
  66. /****************************************/
  67. /* Turn off the red "Working" light     */
  68. /****************************************/
  69. CALL VpSetItemValue EEEmainwin,1017,rdledoff
  70.