Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Html2text
#1
Is possible to convert html in txt using QM like this?

<HTML>

<BODY>
<DIV>This is a test.</DIV>
<DIV>&nbsp;</DIV><DIV align="left">
<TABLE border="1" cellspacing="1" width="50%">
<TR height="20">
<TD valign="middle">text1</TD>
<TD width="20%" height="20" valign="middle">text2</TD>
</TR>
<TR height="20">
<TD width="20%" height="20" valign="middle">text3</TD>
<TD width="20%" height="20" valign="middle">text4</TD>
</TR>
<TR height="20">
<TD width="20%" height="20" valign="middle">text5</TD>
<TD width="20%" height="20" valign="middle">text6</TD>
</TR>
</TABLE>
</DIV>
<DIV>&nbsp;</DIV>
<DIV>End.</DIV>
</BODY>
</HTML>

---->


Attached Files Image(s)
   
#2
I don't know an easy way. Very difficult.
#3
Could https://github.com/mtibben/html2text/bl ... l2Text.php help?
#4
To run PHP in QM:
Executing PHP code in QM
Very old. I did not test now.
#5
I can't test too. Is possible to translate to QM language?
#6
Much work.
#7
You can use Lynx.

Download and install:
http://invisible-island.net/lynx/#installers
I choose "Latest built with curses (color-style)".

Test with a URL or existing file:
Macro Macro2533
Code:
Copy      Help
;run "$program files$\Lynx - web browser\lynx.exe" "http://www.quickmacros.com" "" "*" 0x10000

out
str txt
str lynxDir="$program files$\Lynx - web browser"
str url="http://www.quickmacros.com"
RunConsole2 F"{lynxDir}\lynx.exe -dump -nolist {url}" txt lynxDir
out txt

;-nolist removes [link number] and link URLs
Test with HTML saved in a temp file:
Macro Macro2534
Code:
Copy      Help
out
str html=
;<HTML>
;<BODY>
;<DIV>This is a test.</DIV>
;<DIV>&nbsp;</DIV><DIV align="left">
;<TABLE border="1" cellspacing="1" width="50%">
;<TR height="20">
;<TD valign="middle">text1</TD>
;<TD width="20%" height="20" valign="middle">text2</TD>
;</TR>
;<TR height="20">
;<TD width="20%" height="20" valign="middle">text3</TD>
;<TD width="20%" height="20" valign="middle">text4</TD>
;</TR>
;<TR height="20">
;<TD width="20%" height="20" valign="middle">text5</TD>
;<TD width="20%" height="20" valign="middle">text6</TD>
;</TR>
;</TABLE>
;</DIV>
;<DIV>&nbsp;</DIV>
;<DIV>End.</DIV>
;</BODY>
;</HTML>

str txt
str lynxDir="$program files$\Lynx - web browser"
__TempFile tf.Init("htm" "" "" html)
RunConsole2 F"{lynxDir}\lynx.exe -dump -nomargins {tf}" txt lynxDir
out txt


There are many command line options etc, all documented there.
#8
Thanks.
#9
I tested: http://www.paehl.com/open_source/?TextB ... extbrowser

Looks like magic...

Note: also transforms the tables.

It's a pity that there is no dll to use in QM...


Forum Jump:


Users browsing this thread: 1 Guest(s)