<?xml version="1.0" encoding="utf-8"?>
<rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom">
	<channel>
		<title><![CDATA[Серый форум &mdash; AHK: Конвертор html в текст через UWP API]]></title>
		<link>http://forum.script-coding.com/viewtopic.php?id=17675</link>
		<atom:link href="http://forum.script-coding.com/extern.php?action=feed&amp;tid=17675&amp;type=rss" rel="self" type="application/rss+xml" />
		<description><![CDATA[Недавние сообщения в теме «AHK: Конвертор html в текст через UWP API».]]></description>
		<lastBuildDate>Mon, 13 Mar 2023 08:29:46 +0000</lastBuildDate>
		<generator>PunBB</generator>
		<item>
			<title><![CDATA[AHK: Конвертор html в текст через UWP API]]></title>
			<link>http://forum.script-coding.com/viewtopic.php?pid=157145#p157145</link>
			<description><![CDATA[<p>Конвертор html в txt:<br /><a href="https://docs.microsoft.com/en-us/uwp/api/windows.data.html.htmlutilities.converttotext">https://docs.microsoft.com/en-us/uwp/ap … verttotext</a><br /></p><div class="codebox"><pre><code>html := &quot;&lt;p&gt;test&lt;/p&gt;&quot; 
msgbox % ConvertToText(html)


ConvertToText(string)
{
   static HtmlUtilities
   if (HtmlUtilities = &quot;&quot;)
      CreateClass(&quot;Windows.Data.Html.HtmlUtilities&quot;, IHtmlUtilities := &quot;{FEC00ADD-2399-4FAC-B5A7-05E9ACD7181D}&quot;, HtmlUtilities)
   CreateHString(string, hHtml)
   DllCall(NumGet(NumGet(HtmlUtilities+0)+6*A_PtrSize), &quot;ptr&quot;, HtmlUtilities, &quot;ptr&quot;, hHtml, &quot;ptr*&quot;, hText)   ; ConvertToText
   DeleteHString(hHtml)
   buffer := DllCall(&quot;Combase.dll\WindowsGetStringRawBuffer&quot;, &quot;ptr&quot;, hText, &quot;uint*&quot;, length, &quot;ptr&quot;)
   return StrGet(buffer, &quot;UTF-16&quot;)
}

CreateClass(string, interface, ByRef Class)
{
   CreateHString(string, hString)
   VarSetCapacity(GUID, 16)
   DllCall(&quot;ole32\CLSIDFromString&quot;, &quot;wstr&quot;, interface, &quot;ptr&quot;, &amp;GUID)
   result := DllCall(&quot;Combase.dll\RoGetActivationFactory&quot;, &quot;ptr&quot;, hString, &quot;ptr&quot;, &amp;GUID, &quot;ptr*&quot;, Class, &quot;uint&quot;)
   if (result != 0)
   {
      if (result = 0x80004002)
         msgbox No such interface supported
      else if (result = 0x80040154)
         msgbox Class not registered
      else
         msgbox error: %result%
      ExitApp
   }
   DeleteHString(hString)
}

CreateHString(string, ByRef hString)
{
    DllCall(&quot;Combase.dll\WindowsCreateString&quot;, &quot;wstr&quot;, string, &quot;uint&quot;, StrLen(string), &quot;ptr*&quot;, hString)
}

DeleteHString(hString)
{
   DllCall(&quot;Combase.dll\WindowsDeleteString&quot;, &quot;ptr&quot;, hString)
}</code></pre></div><p><a href="http://forum.script-coding.com/viewtopic.php?id=15188">Тема для обсуждения</a></p>]]></description>
			<author><![CDATA[null@example.com (Malcev)]]></author>
			<pubDate>Mon, 13 Mar 2023 08:29:46 +0000</pubDate>
			<guid>http://forum.script-coding.com/viewtopic.php?pid=157145#p157145</guid>
		</item>
	</channel>
</rss>
