<?xml version="1.0" encoding="utf-8"?>
<feed xmlns="http://www.w3.org/2005/Atom">
	<title type="html"><![CDATA[Серый форум &mdash; AHK: Переводчик онлайн]]></title>
	<link rel="self" href="http://forum.script-coding.com/extern.php?action=feed&amp;tid=5660&amp;type=atom" />
	<updated>2021-09-14T14:33:42Z</updated>
	<generator>PunBB</generator>
	<id>http://forum.script-coding.com/viewtopic.php?id=5660</id>
		<entry>
			<title type="html"><![CDATA[Re: AHK: Переводчик онлайн]]></title>
			<link rel="alternate" href="http://forum.script-coding.com/viewtopic.php?pid=149536#p149536" />
			<content type="html"><![CDATA[<p><strong>elektrovenik</strong>, согласен, добавлю, как руки дойдут. <img src="//forum.script-coding.com/img/smilies/smile.png" width="15" height="15" /></p>]]></content>
			<author>
				<name><![CDATA[teadrinker]]></name>
				<uri>http://forum.script-coding.com/profile.php?id=24515</uri>
			</author>
			<updated>2021-09-14T14:33:42Z</updated>
			<id>http://forum.script-coding.com/viewtopic.php?pid=149536#p149536</id>
		</entry>
		<entry>
			<title type="html"><![CDATA[Re: AHK: Переводчик онлайн]]></title>
			<link rel="alternate" href="http://forum.script-coding.com/viewtopic.php?pid=149535#p149535" />
			<content type="html"><![CDATA[<p>Приветствую! На мой взгляд не хватает функции/кнопки быстрого копирования переведенного текста. Можно добавить эту кнопку рядом с кнопкой плей\стоп воспроизведения текста, либо сделать чекбокс, включающий возможность автокопирования в буфер уже переведенного текста.</p>]]></content>
			<author>
				<name><![CDATA[elektrovenik]]></name>
				<uri>http://forum.script-coding.com/profile.php?id=29521</uri>
			</author>
			<updated>2021-09-14T08:51:26Z</updated>
			<id>http://forum.script-coding.com/viewtopic.php?pid=149535#p149535</id>
		</entry>
		<entry>
			<title type="html"><![CDATA[Re: AHK: Переводчик онлайн]]></title>
			<link rel="alternate" href="http://forum.script-coding.com/viewtopic.php?pid=146950#p146950" />
			<content type="html"><![CDATA[<p>Обновил <a href="https://forum.script-coding.com/viewtopic.php?pid=35906#p35906">пост</a> в Коллекции.</p>]]></content>
			<author>
				<name><![CDATA[teadrinker]]></name>
				<uri>http://forum.script-coding.com/profile.php?id=24515</uri>
			</author>
			<updated>2021-03-26T00:09:41Z</updated>
			<id>http://forum.script-coding.com/viewtopic.php?pid=146950#p146950</id>
		</entry>
		<entry>
			<title type="html"><![CDATA[Re: AHK: Переводчик онлайн]]></title>
			<link rel="alternate" href="http://forum.script-coding.com/viewtopic.php?pid=146949#p146949" />
			<content type="html"><![CDATA[<p>Ага, класс, я был уверен, что ты что-то нагуглишь! <img src="//forum.script-coding.com/img/smilies/smile.png" width="15" height="15" /></p>]]></content>
			<author>
				<name><![CDATA[teadrinker]]></name>
				<uri>http://forum.script-coding.com/profile.php?id=24515</uri>
			</author>
			<updated>2021-03-25T23:26:46Z</updated>
			<id>http://forum.script-coding.com/viewtopic.php?pid=146949#p146949</id>
		</entry>
		<entry>
			<title type="html"><![CDATA[Re: AHK: Переводчик онлайн]]></title>
			<link rel="alternate" href="http://forum.script-coding.com/viewtopic.php?pid=146948#p146948" />
			<content type="html"><![CDATA[<p>Первый у меня тоже дает:<br /></p><div class="codebox"><pre><code>MsgBox, % GoogleTranslate(&quot;test&quot;, &quot;en&quot;, &quot;ru&quot;)

GoogleTranslate(str, from := &quot;auto&quot;, to := &quot;en&quot;)  {
   static JS := CreateScriptObj(), _ := JS.( GetJScript() ) := JS.(&quot;delete ActiveXObject; delete GetObject;&quot;)
   
   json := SendRequest(JS, str, to, from, proxy := &quot;&quot;)
   oJSON := JS.(&quot;(&quot; . json . &quot;)&quot;)

   if !IsObject(oJSON[1])  {
      Loop % oJSON[0].length
         trans .= oJSON[0][A_Index - 1][0]
   }
   else  {
      MainTransText := oJSON[0][0][0]
      Loop % oJSON[1].length  {
         trans .= &quot;`n+&quot;
         obj := oJSON[1][A_Index-1][1]
         Loop % obj.length  {
            txt := obj[A_Index - 1]
            trans .= (MainTransText = txt ? &quot;&quot; : &quot;`n&quot; txt)
         }
      }
   }
   if !IsObject(oJSON[1])
      MainTransText := trans := Trim(trans, &quot;,+`n &quot;)
   else
      trans := MainTransText . &quot;`n+`n&quot; . Trim(trans, &quot;,+`n &quot;)

   from := oJSON[2]
   trans := Trim(trans, &quot;,+`n &quot;)
   Return trans
}

SendRequest(JS, str, tl, sl, proxy) {
   static http
   ComObjError(false)
   if !http
   {
      http := ComObjCreate(&quot;WinHttp.WinHttpRequest.5.1&quot;)
      ( proxy &amp;&amp; http.SetProxy(2, proxy) )
      http.open( &quot;get&quot;, &quot;https://translate.google.com&quot;, 1 )
      http.SetRequestHeader(&quot;User-Agent&quot;, &quot;Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:47.0) Gecko/20100101 Firefox/47.0&quot;)
      http.send()
      http.WaitForResponse(-1)
   }

   http.open( &quot;POST&quot;, &quot;https://translate.googleapis.com/translate_a/single?client=gtx&amp;sl=&quot;
      . sl . &quot;&amp;tl=&quot; . tl . &quot;&amp;hl=&quot; . tl
      . &quot;&amp;dt=at&amp;dt=bd&amp;dt=ex&amp;dt=ld&amp;dt=md&amp;dt=qca&amp;dt=rw&amp;dt=rm&amp;dt=ss&amp;dt=t&amp;ie=UTF-8&amp;oe=UTF-8&amp;otf=0&amp;ssel=0&amp;tsel=0&amp;pc=1&amp;kc=1&quot;
      . &quot;&amp;tk=&quot; . JS.(&quot;tk&quot;).(str), 1 )

   http.SetRequestHeader(&quot;Content-Type&quot;, &quot;application/x-www-form-urlencoded;charset=utf-8&quot;)
   http.SetRequestHeader(&quot;User-Agent&quot;, &quot;Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:47.0) Gecko/20100101 Firefox/47.0&quot;)
   http.send(&quot;q=&quot; . URIEncode(str))
   http.WaitForResponse(-1)
msgbox % http.responsetext
   Return http.responsetext
}

URIEncode(str, encoding := &quot;UTF-8&quot;)  {
   VarSetCapacity(var, StrPut(str, encoding))
   StrPut(str, &amp;var, encoding)

   While code := NumGet(Var, A_Index - 1, &quot;UChar&quot;)  {
      bool := (code &gt; 0x7F || code &lt; 0x30 || code = 0x3D)
      UrlStr .= bool ? &quot;%&quot; . Format(&quot;{:02X}&quot;, code) : Chr(code)
   }
   Return UrlStr
}

GetJScript()
{
   script =
   (
      var TKK = ((function() {
        var a = 561666268;
        var b = 1526272306;
        return 406398 + &#039;.&#039; + (a + b);
      })());

      function b(a, b) {
        for (var d = 0; d &lt; b.length - 2; d += 3) {
            var c = b.charAt(d + 2),
                c = &quot;a&quot; &lt;= c ? c.charCodeAt(0) - 87 : Number(c),
                c = &quot;+&quot; == b.charAt(d + 1) ? a &gt;&gt;&gt; c : a &lt;&lt; c;
            a = &quot;+&quot; == b.charAt(d) ? a + c &amp; 4294967295 : a ^ c
        }
        return a
      }

      function tk(a) {
          for (var e = TKK.split(&quot;.&quot;), h = Number(e[0]) || 0, g = [], d = 0, f = 0; f &lt; a.length; f++) {
              var c = a.charCodeAt(f);
              128 &gt; c ? g[d++] = c : (2048 &gt; c ? g[d++] = c &gt;&gt; 6 | 192 : (55296 == (c &amp; 64512) &amp;&amp; f + 1 &lt; a.length &amp;&amp; 56320 == (a.charCodeAt(f + 1) &amp; 64512) ?
              (c = 65536 + ((c &amp; 1023) &lt;&lt; 10) + (a.charCodeAt(++f) &amp; 1023), g[d++] = c &gt;&gt; 18 | 240,
              g[d++] = c &gt;&gt; 12 &amp; 63 | 128) : g[d++] = c &gt;&gt; 12 | 224, g[d++] = c &gt;&gt; 6 &amp; 63 | 128), g[d++] = c &amp; 63 | 128)
          }
          a = h;
          for (d = 0; d &lt; g.length; d++) a += g[d], a = b(a, &quot;+-a^+6&quot;);
          a = b(a, &quot;+-3^+b+-f&quot;);
          a ^= Number(e[1]) || 0;
          0 &gt; a &amp;&amp; (a = (a &amp; 2147483647) + 2147483648);
          a `%= 1E6;
          return a.toString() + &quot;.&quot; + (a ^ h)
      }
   )
   Return script
}

CreateScriptObj() {
   static doc
   doc := ComObjCreate(&quot;htmlfile&quot;)
   doc.write(&quot;&lt;meta http-equiv=&#039;X-UA-Compatible&#039; content=&#039;IE=9&#039;&gt;&quot;)
   Return ObjBindMethod(doc.parentWindow, &quot;eval&quot;)
}</code></pre></div>]]></content>
			<author>
				<name><![CDATA[Malcev]]></name>
				<uri>http://forum.script-coding.com/profile.php?id=26930</uri>
			</author>
			<updated>2021-03-25T23:21:35Z</updated>
			<id>http://forum.script-coding.com/viewtopic.php?pid=146948#p146948</id>
		</entry>
		<entry>
			<title type="html"><![CDATA[Re: AHK: Переводчик онлайн]]></title>
			<link rel="alternate" href="http://forum.script-coding.com/viewtopic.php?pid=146947#p146947" />
			<content type="html"><![CDATA[<p>А, нет, второй вариант вроде даёт! Надо потестить.</p>]]></content>
			<author>
				<name><![CDATA[teadrinker]]></name>
				<uri>http://forum.script-coding.com/profile.php?id=24515</uri>
			</author>
			<updated>2021-03-25T23:14:49Z</updated>
			<id>http://forum.script-coding.com/viewtopic.php?pid=146947#p146947</id>
		</entry>
		<entry>
			<title type="html"><![CDATA[Re: AHK: Переводчик онлайн]]></title>
			<link rel="alternate" href="http://forum.script-coding.com/viewtopic.php?pid=146946#p146946" />
			<content type="html"><![CDATA[<p>Спасибо, работает! Но не даёт вариантов:<br /><a href="https://translate.googleapis.com/translate_a/single?client=gtx&amp;sl=en&amp;tl=ru&amp;dt=t&amp;q=test">https://translate.googleapis.com/transl … amp;q=test</a><br /></p><div class="quotebox"><blockquote><p>[[[&quot;тест&quot;,&quot;test&quot;,null,null,10]<br />]<br />,null,&quot;en&quot;,null,null,null,null,[]<br />]</p></blockquote></div>]]></content>
			<author>
				<name><![CDATA[teadrinker]]></name>
				<uri>http://forum.script-coding.com/profile.php?id=24515</uri>
			</author>
			<updated>2021-03-25T23:13:01Z</updated>
			<id>http://forum.script-coding.com/viewtopic.php?pid=146946#p146946</id>
		</entry>
		<entry>
			<title type="html"><![CDATA[Re: AHK: Переводчик онлайн]]></title>
			<link rel="alternate" href="http://forum.script-coding.com/viewtopic.php?pid=146945#p146945" />
			<content type="html"><![CDATA[<p>Либо так:<br /></p><div class="codebox"><pre><code>https://translate.googleapis.com/translate_a/single?client=gtx</code></pre></div><p>Либо так:<br /></p><div class="codebox"><pre><code>https://clients5.google.com/translate_a/t?client=dict-chrome-ex</code></pre></div>]]></content>
			<author>
				<name><![CDATA[Malcev]]></name>
				<uri>http://forum.script-coding.com/profile.php?id=26930</uri>
			</author>
			<updated>2021-03-25T23:03:56Z</updated>
			<id>http://forum.script-coding.com/viewtopic.php?pid=146945#p146945</id>
		</entry>
		<entry>
			<title type="html"><![CDATA[Re: AHK: Переводчик онлайн]]></title>
			<link rel="alternate" href="http://forum.script-coding.com/viewtopic.php?pid=146935#p146935" />
			<content type="html"><![CDATA[<p><span class="postimg"><img src="https://i.imgur.com/aX5qX7B.png" alt="https://i.imgur.com/aX5qX7B.png" /></span></p>]]></content>
			<author>
				<name><![CDATA[teadrinker]]></name>
				<uri>http://forum.script-coding.com/profile.php?id=24515</uri>
			</author>
			<updated>2021-03-25T21:36:33Z</updated>
			<id>http://forum.script-coding.com/viewtopic.php?pid=146935#p146935</id>
		</entry>
		<entry>
			<title type="html"><![CDATA[Re: AHK: Переводчик онлайн]]></title>
			<link rel="alternate" href="http://forum.script-coding.com/viewtopic.php?pid=146934#p146934" />
			<content type="html"><![CDATA[<p>А пример можешь привести?</p>]]></content>
			<author>
				<name><![CDATA[Malcev]]></name>
				<uri>http://forum.script-coding.com/profile.php?id=26930</uri>
			</author>
			<updated>2021-03-25T21:29:40Z</updated>
			<id>http://forum.script-coding.com/viewtopic.php?pid=146934#p146934</id>
		</entry>
		<entry>
			<title type="html"><![CDATA[Re: AHK: Переводчик онлайн]]></title>
			<link rel="alternate" href="http://forum.script-coding.com/viewtopic.php?pid=146930#p146930" />
			<content type="html"><![CDATA[<p>Не, стало криво переводить, не так, как на сайте Google Translate.</p>]]></content>
			<author>
				<name><![CDATA[teadrinker]]></name>
				<uri>http://forum.script-coding.com/profile.php?id=24515</uri>
			</author>
			<updated>2021-03-25T21:14:35Z</updated>
			<id>http://forum.script-coding.com/viewtopic.php?pid=146930#p146930</id>
		</entry>
		<entry>
			<title type="html"><![CDATA[Re: AHK: Переводчик онлайн]]></title>
			<link rel="alternate" href="http://forum.script-coding.com/viewtopic.php?pid=146927#p146927" />
			<content type="html"><![CDATA[<p>У меня вроде нормально работает.</p>]]></content>
			<author>
				<name><![CDATA[Malcev]]></name>
				<uri>http://forum.script-coding.com/profile.php?id=26930</uri>
			</author>
			<updated>2021-03-25T20:57:22Z</updated>
			<id>http://forum.script-coding.com/viewtopic.php?pid=146927#p146927</id>
		</entry>
		<entry>
			<title type="html"><![CDATA[Re: AHK: Переводчик онлайн]]></title>
			<link rel="alternate" href="http://forum.script-coding.com/viewtopic.php?pid=146923#p146923" />
			<content type="html"><![CDATA[<p>Опять вроде алгоритм поменялся.</p>]]></content>
			<author>
				<name><![CDATA[teadrinker]]></name>
				<uri>http://forum.script-coding.com/profile.php?id=24515</uri>
			</author>
			<updated>2021-03-25T18:15:16Z</updated>
			<id>http://forum.script-coding.com/viewtopic.php?pid=146923#p146923</id>
		</entry>
		<entry>
			<title type="html"><![CDATA[Re: AHK: Переводчик онлайн]]></title>
			<link rel="alternate" href="http://forum.script-coding.com/viewtopic.php?pid=139337#p139337" />
			<content type="html"><![CDATA[<p>Нет, я этим не интересовался.</p>]]></content>
			<author>
				<name><![CDATA[teadrinker]]></name>
				<uri>http://forum.script-coding.com/profile.php?id=24515</uri>
			</author>
			<updated>2020-05-05T15:50:44Z</updated>
			<id>http://forum.script-coding.com/viewtopic.php?pid=139337#p139337</id>
		</entry>
		<entry>
			<title type="html"><![CDATA[Re: AHK: Переводчик онлайн]]></title>
			<link rel="alternate" href="http://forum.script-coding.com/viewtopic.php?pid=139336#p139336" />
			<content type="html"><![CDATA[<p><strong>teadrinker</strong>, не было ли варианта основной части скрипта для возможности перевода HTML-кода, как это происходит по кнопке из браузера? — <span class="postimg"><img src="https://i.imgur.com/SZ3jSmC.png" alt="https://i.imgur.com/SZ3jSmC.png" /></span></p>]]></content>
			<author>
				<name><![CDATA[DD]]></name>
				<uri>http://forum.script-coding.com/profile.php?id=25263</uri>
			</author>
			<updated>2020-05-05T15:30:09Z</updated>
			<id>http://forum.script-coding.com/viewtopic.php?pid=139336#p139336</id>
		</entry>
</feed>
