home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
OS/2 Shareware BBS: 5 Edit
/
05-Edit.zip
/
eeedit22.zip
/
enhanced.zip
/
Txt2Html.plg
< prev
next >
Wrap
Text File
|
2001-04-15
|
3KB
|
70 lines
/****************************************/
/* Sample for working on the content of */
/* the MLE with an external program */
/* */
/* This sample uses Valera Veryazov's */
/* TXT2HTML.EXE to convert text from */
/* the editor into an html file */
/* and reloads it into the editor */
/* */
/* You MUST SET THE LOCATION of */
/* the TXT2HTML program to use this! */
/****************************************/
/****************************************/
/* Set Txt2Html.cmd location. "IniDir" */
/* is always the location of the editor */
/****************************************/
Txt2Html=IniDir||'\Txt2Html.exe'
rc=SysFileTree(Txt2Html,'List','FO')
if List.0<1 then do
response=VpMessageBox(window,'ERROR!','You must set the location of Txt2Html.exe to use this plugin')
return
end
/****************************************/
/* Turn on the red "Working" light */
/****************************************/
Call VpSetItemValue EEEmainwin,1017,rdledon
/****************************************/
/* Get name of current file and set the */
/* workfiles to be built beside it */
/* "FileName" is always the name of the */
/* file currently loaded in the editor */
/****************************************/
if FileName<>'' then parse var FileName WorkFileName '.' ext
else WorkFileName=IniDir||'\Txt2Html'
WorkFile=WorkFileName||'.T2H'
HtmlFile=WorkFileName||'.html'
/****************************************/
/* Get contents of the edit window */
/* and write them to the work file */
/****************************************/
Document = VpGetItemValue(window,Target)
rc=charout(WorkFile,Document)
rc=Stream(WorkFile,'C','Close')
/****************************************/
/* run txt2html here on WorkFile */
/* Does this need two arguments? */
/****************************************/
address cmd Txt2Html WorkFile
/****************************************/
/* Read the new html file and load it */
/* using the editors internal 'openfile'*/
/****************************************/
Call Openfile HtmlFile
/****************************************/
/* Delete the workfile */
/****************************************/
rc=SysFileDelete(WorkFile)
/****************************************/
/* Turn off the red "Working" light */
/****************************************/
CALL VpSetItemValue EEEmainwin,1017,rdledoff