<?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="https://forum.script-coding.com/extern.php?action=feed&amp;tid=11079&amp;type=atom" />
	<updated>2015-11-16T13:47:02Z</updated>
	<generator>PunBB</generator>
	<id>https://forum.script-coding.com/viewtopic.php?id=11079</id>
		<entry>
			<title type="html"><![CDATA[Re: AHK: Конвертация текста]]></title>
			<link rel="alternate" href="https://forum.script-coding.com/viewtopic.php?pid=99095#p99095" />
			<content type="html"><![CDATA[<p>У <strong>becauseim</strong>, регистр остается прежним.</p>]]></content>
			<author>
				<name><![CDATA[Alectric]]></name>
				<uri>https://forum.script-coding.com/profile.php?id=26027</uri>
			</author>
			<updated>2015-11-16T13:47:02Z</updated>
			<id>https://forum.script-coding.com/viewtopic.php?pid=99095#p99095</id>
		</entry>
		<entry>
			<title type="html"><![CDATA[Re: AHK: Конвертация текста]]></title>
			<link rel="alternate" href="https://forum.script-coding.com/viewtopic.php?pid=99094#p99094" />
			<content type="html"><![CDATA[<p>Ругается на 30-ю строчку, там точка с запятой откуда-то взялась перед&nbsp; =. После исправления, в Блокноте заменяет английскую абракадабру на русский текст в нижнем регистре. Русскую абракадабру просто удаляет.</p>]]></content>
			<author>
				<name><![CDATA[YMP]]></name>
				<uri>https://forum.script-coding.com/profile.php?id=81</uri>
			</author>
			<updated>2015-11-16T13:44:48Z</updated>
			<id>https://forum.script-coding.com/viewtopic.php?pid=99094#p99094</id>
		</entry>
		<entry>
			<title type="html"><![CDATA[Re: AHK: Конвертация текста]]></title>
			<link rel="alternate" href="https://forum.script-coding.com/viewtopic.php?pid=99093#p99093" />
			<content type="html"><![CDATA[<p>Проверь, пожалуйста, хотя-бы что проблем с регистром букв при конвертации нет. <a href="http://forum.script-coding.com/viewtopic.php?pid=99081#p99081">Этот код.</a></p>]]></content>
			<author>
				<name><![CDATA[Alectric]]></name>
				<uri>https://forum.script-coding.com/profile.php?id=26027</uri>
			</author>
			<updated>2015-11-16T13:33:36Z</updated>
			<id>https://forum.script-coding.com/viewtopic.php?pid=99093#p99093</id>
		</entry>
		<entry>
			<title type="html"><![CDATA[Re: AHK: Конвертация текста]]></title>
			<link rel="alternate" href="https://forum.script-coding.com/viewtopic.php?pid=99089#p99089" />
			<content type="html"><![CDATA[<p>Я Скайпом не пользуюсь.</p>]]></content>
			<author>
				<name><![CDATA[YMP]]></name>
				<uri>https://forum.script-coding.com/profile.php?id=81</uri>
			</author>
			<updated>2015-11-16T12:48:19Z</updated>
			<id>https://forum.script-coding.com/viewtopic.php?pid=99089#p99089</id>
		</entry>
		<entry>
			<title type="html"><![CDATA[Re: AHK: Конвертация текста]]></title>
			<link rel="alternate" href="https://forum.script-coding.com/viewtopic.php?pid=99087#p99087" />
			<content type="html"><![CDATA[<p><strong>YMP</strong>, у нас тут битва экстрасенсов <img src="//forum.script-coding.com/img/smilies/big_smile.png" width="15" height="15" /><br />А если серьезно, было бы кстати, если бы Вы протестировали на своей &quot;десятке&quot; в окне Скайпа вариант из 16 поста от <strong>Alectric</strong>. Подозреваю, что у меня одного все так плохо.</p>]]></content>
			<author>
				<name><![CDATA[becauseim]]></name>
				<uri>https://forum.script-coding.com/profile.php?id=33149</uri>
			</author>
			<updated>2015-11-16T12:37:41Z</updated>
			<id>https://forum.script-coding.com/viewtopic.php?pid=99087#p99087</id>
		</entry>
		<entry>
			<title type="html"><![CDATA[Re: AHK: Конвертация текста]]></title>
			<link rel="alternate" href="https://forum.script-coding.com/viewtopic.php?pid=99086#p99086" />
			<content type="html"><![CDATA[<p>У меня 10 стоит. А в чём мистика-то, не пойму. У вас тут какой-то таинственный разговор происходит, непонятный непосвящённому.</p>]]></content>
			<author>
				<name><![CDATA[YMP]]></name>
				<uri>https://forum.script-coding.com/profile.php?id=81</uri>
			</author>
			<updated>2015-11-16T11:59:22Z</updated>
			<id>https://forum.script-coding.com/viewtopic.php?pid=99086#p99086</id>
		</entry>
		<entry>
			<title type="html"><![CDATA[Re: AHK: Конвертация текста]]></title>
			<link rel="alternate" href="https://forum.script-coding.com/viewtopic.php?pid=99084#p99084" />
			<content type="html"><![CDATA[<p>Впрочем, теперь и этот метод перестал дружить со Скайпом.</p>]]></content>
			<author>
				<name><![CDATA[becauseim]]></name>
				<uri>https://forum.script-coding.com/profile.php?id=33149</uri>
			</author>
			<updated>2015-11-16T10:16:58Z</updated>
			<id>https://forum.script-coding.com/viewtopic.php?pid=99084#p99084</id>
		</entry>
		<entry>
			<title type="html"><![CDATA[Re: AHK: Конвертация текста]]></title>
			<link rel="alternate" href="https://forum.script-coding.com/viewtopic.php?pid=99083#p99083" />
			<content type="html"><![CDATA[<p>OFF: Что за мистика у него там происходит?!... У кого-нибудь еще стоит windows 10, кто-нибудь может это подтвердить?</p>]]></content>
			<author>
				<name><![CDATA[Alectric]]></name>
				<uri>https://forum.script-coding.com/profile.php?id=26027</uri>
			</author>
			<updated>2015-11-16T10:00:41Z</updated>
			<id>https://forum.script-coding.com/viewtopic.php?pid=99083#p99083</id>
		</entry>
		<entry>
			<title type="html"><![CDATA[Re: AHK: Конвертация текста]]></title>
			<link rel="alternate" href="https://forum.script-coding.com/viewtopic.php?pid=99082#p99082" />
			<content type="html"><![CDATA[<p><span class="postimg"><img src="https://i.gyazo.com/123619ea7d689b55995b49625b02fe15.gif" alt="https://i.gyazo.com/123619ea7d689b55995b49625b02fe15.gif" /></span></p>]]></content>
			<author>
				<name><![CDATA[becauseim]]></name>
				<uri>https://forum.script-coding.com/profile.php?id=33149</uri>
			</author>
			<updated>2015-11-16T09:54:58Z</updated>
			<id>https://forum.script-coding.com/viewtopic.php?pid=99082#p99082</id>
		</entry>
		<entry>
			<title type="html"><![CDATA[Re: AHK: Конвертация текста]]></title>
			<link rel="alternate" href="https://forum.script-coding.com/viewtopic.php?pid=99081#p99081" />
			<content type="html"><![CDATA[<p>Дану... напечатай слово заглавными буквами(без капслока) и смени этому слову раскладку.</p><p>...</p><p>Нужно исправить возвращаемое значение на:<br /></p><div class="codebox"><pre><code>    return &quot;{vk&quot; VK &quot;}&quot;
</code></pre></div><div class="codebox"><pre><code>SendMode Input
#LAlt::
Send ^+{Left}^{vk58} ; Выделить и вырезать последнее слово слева от каретки
if (old_layout = &quot;RU&quot;)
	{
		SendMessage, 0x50,, % Locale_EN,, A
	}
else
	{
		SendMessage, 0x50,, % Locale_RU,, A
	}
gosub, Paste
return


Paste:
KeyWait Ctrl
for k, v in StrSplit(clipboard)
    Send % CharToVk(v)
return



; ---------- Functions -----------

CharToVk(Char)
{
    static Eng := 0x4090409, Rus := 0x4190419
    CharCode := Asc(Char)
    Lang := charcode &gt; 127 ? Rus : Eng
    PrevLang := getscriptlang()
    If (Lang != PrevLang) {
        SetScriptLang(Lang)
    }
    VK := DllCall(&quot;VkKeyScan&quot;, &quot;uchar&quot;, CharCode, &quot;Short&quot;)
    SetFormat, Integer, H
    VK :=  SubStr(VK &amp; 0xFF, 3)
    StringUpper, VK, VK
    SetFormat, Integer, D
    If (Lang != PrevLang) {
        SetScriptLang(PrevLang)
    }
    return &quot;{vk&quot; VK &quot;}&quot;
}

GetScriptLang()
{
    static ThreadID := 0
    If (ThreadID = 0)
        ThreadID := DllCall(&quot;GetWindowThreadProcessId&quot;, &quot;ptr&quot;, A_ScriptHwnd, &quot;uint&quot;, 0, &quot;ptr&quot;)
    Return DllCall(&quot;GetKeyboardLayout&quot;, &quot;ptr&quot;, ThreadID, &quot;ptr&quot;)
}

SetScriptLang(Lang)
{
    static Func := &quot;PostMessage&quot; . (A_IsUnicode? &quot;W&quot;:&quot;A&quot;)
    DllCall(Func, &quot;ptr&quot;, A_ScriptHwnd, &quot;uint&quot;, 0x50, &quot;ptr&quot;, 0, &quot;ptr&quot;, Lang)
    Sleep, -1
}
</code></pre></div>]]></content>
			<author>
				<name><![CDATA[Alectric]]></name>
				<uri>https://forum.script-coding.com/profile.php?id=26027</uri>
			</author>
			<updated>2015-11-16T09:49:35Z</updated>
			<id>https://forum.script-coding.com/viewtopic.php?pid=99081#p99081</id>
		</entry>
		<entry>
			<title type="html"><![CDATA[Re: AHK: Конвертация текста]]></title>
			<link rel="alternate" href="https://forum.script-coding.com/viewtopic.php?pid=99079#p99079" />
			<content type="html"><![CDATA[<p><strong>Alectric</strong>, используя имеющийся вариант из первого поста, проблем с регистром не возникает.</p><p>На данный момент у меня не получилось связать модификацию от <strong>YMP</strong> с отправлением скопированного текста.</p>]]></content>
			<author>
				<name><![CDATA[becauseim]]></name>
				<uri>https://forum.script-coding.com/profile.php?id=33149</uri>
			</author>
			<updated>2015-11-16T09:45:23Z</updated>
			<id>https://forum.script-coding.com/viewtopic.php?pid=99079#p99079</id>
		</entry>
		<entry>
			<title type="html"><![CDATA[Re: AHK: Конвертация текста]]></title>
			<link rel="alternate" href="https://forum.script-coding.com/viewtopic.php?pid=99078#p99078" />
			<content type="html"><![CDATA[<p>Далее возникнет проблема регистра букв...</p>]]></content>
			<author>
				<name><![CDATA[Alectric]]></name>
				<uri>https://forum.script-coding.com/profile.php?id=26027</uri>
			</author>
			<updated>2015-11-16T09:37:37Z</updated>
			<id>https://forum.script-coding.com/viewtopic.php?pid=99078#p99078</id>
		</entry>
		<entry>
			<title type="html"><![CDATA[Re: AHK: Конвертация текста]]></title>
			<link rel="alternate" href="https://forum.script-coding.com/viewtopic.php?pid=99077#p99077" />
			<content type="html"><![CDATA[<p>Чтобы код определялся для обоих языков, нужно переключать язык самого скрипта. Например, так.<br /></p><div class="codebox"><pre><code>
MsgBox, % CharToVk(&quot;a&quot;) &quot;`n&quot; CharToVk(&quot;ф&quot;)


; ---------- Functions -----------

CharToVk(Char)
{
    static Eng := 0x4090409, Rus := 0x4190419
    CharCode := Asc(Char)
    Lang := CharCode &gt; 127 ? Rus : Eng
    PrevLang := GetScriptLang()
    If (Lang != PrevLang) {
        SetScriptLang(Lang)
    }
    VK := DllCall(&quot;VkKeyScan&quot;, &quot;uchar&quot;, CharCode, &quot;Short&quot;)
    SetFormat, Integer, H
    VK :=  SubStr(VK &amp; 0xFF, 3)
    StringUpper, VK, VK
    SetFormat, Integer, D
    If (Lang != PrevLang) {
        SetScriptLang(PrevLang)
    }
    Return &quot;vk&quot; VK
}

GetScriptLang()
{
    static ThreadID := DllCall(&quot;GetWindowThreadProcessId&quot;, &quot;ptr&quot;, A_ScriptHwnd, &quot;uint&quot;, 0, &quot;ptr&quot;)
    Return DllCall(&quot;GetKeyboardLayout&quot;, &quot;ptr&quot;, ThreadID, &quot;ptr&quot;)
}

SetScriptLang(Lang)
{
    static Func := &quot;PostMessage&quot; . (A_IsUnicode? &quot;W&quot;:&quot;A&quot;)
    DllCall(Func, &quot;ptr&quot;, A_ScriptHwnd, &quot;uint&quot;, 0x50, &quot;ptr&quot;, 0, &quot;ptr&quot;, Lang)
    Sleep, -1
}
</code></pre></div>]]></content>
			<author>
				<name><![CDATA[YMP]]></name>
				<uri>https://forum.script-coding.com/profile.php?id=81</uri>
			</author>
			<updated>2015-11-16T09:24:16Z</updated>
			<id>https://forum.script-coding.com/viewtopic.php?pid=99077#p99077</id>
		</entry>
		<entry>
			<title type="html"><![CDATA[Re: AHK: Конвертация текста]]></title>
			<link rel="alternate" href="https://forum.script-coding.com/viewtopic.php?pid=99072#p99072" />
			<content type="html"><![CDATA[<p>Проблема того кода с первого поста, то из-за чего исчезает слово:<br /></p><div class="codebox"><pre><code>msgbox,% &quot;ru: &quot; asc(&quot;ф&quot;) &quot;`nen: &quot; asc(&quot;a&quot;)
</code></pre></div><p>Здесь:<br /></p><div class="codebox"><pre><code>VK := DllCall(&quot;VkKeyScan&quot;, &quot;uchar&quot;, Asc(Char), &quot;Short&quot;)
</code></pre></div><p>...</p><div class="codebox"><pre><code>VK1 := DllCall(&quot;VkKeyScan&quot;, &quot;uchar&quot;, Asc(&quot;ф&quot;), &quot;Short&quot;)
VK2 := DllCall(&quot;VkKeyScan&quot;, &quot;uchar&quot;, Asc(&quot;a&quot;), &quot;Short&quot;)

msgbox,% vk1 &quot;`n&quot; vk2
</code></pre></div><p>...</p><p>Возможно можно позаимствовать некоторые функции из <a href="http://forum.script-coding.com/viewtopic.php?id=8104">библиотеки у serzh82saratov</a>.</p>]]></content>
			<author>
				<name><![CDATA[Alectric]]></name>
				<uri>https://forum.script-coding.com/profile.php?id=26027</uri>
			</author>
			<updated>2015-11-16T06:20:11Z</updated>
			<id>https://forum.script-coding.com/viewtopic.php?pid=99072#p99072</id>
		</entry>
		<entry>
			<title type="html"><![CDATA[Re: AHK: Конвертация текста]]></title>
			<link rel="alternate" href="https://forum.script-coding.com/viewtopic.php?pid=99067#p99067" />
			<content type="html"><![CDATA[<p><strong>serzh82saratov</strong>, Скайп падает после второй конвертации.<br />Такая же проблема была и с Punto Switcher до ее обновления.</p><p>Я могу ошибаться, но мне кажется странным, что вариант с отправлением виртуальных кодов никому не приглянулся, т.к. кажется, что такой метод должен работать не хуже при гораздо меньшем объеме кода. И самое, на мой взгляд, интересное, что он должен работать с разными языками, для чего необходимо будет лишь заменить строку с заданной раскладкой.</p>]]></content>
			<author>
				<name><![CDATA[becauseim]]></name>
				<uri>https://forum.script-coding.com/profile.php?id=33149</uri>
			</author>
			<updated>2015-11-16T05:18:20Z</updated>
			<id>https://forum.script-coding.com/viewtopic.php?pid=99067#p99067</id>
		</entry>
</feed>
