<?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=16681&amp;type=atom" />
	<updated>2021-10-27T10:17:19Z</updated>
	<generator>PunBB</generator>
	<id>https://forum.script-coding.com/viewtopic.php?id=16681</id>
		<entry>
			<title type="html"><![CDATA[Re: AHK: неправильно работает код при русской раскладке клавиатуры]]></title>
			<link rel="alternate" href="https://forum.script-coding.com/viewtopic.php?pid=150229#p150229" />
			<content type="html"><![CDATA[<p><strong>teadrinker</strong>, работает, спасибо!</p>]]></content>
			<author>
				<name><![CDATA[CyberGudini]]></name>
				<uri>https://forum.script-coding.com/profile.php?id=42079</uri>
			</author>
			<updated>2021-10-27T10:17:19Z</updated>
			<id>https://forum.script-coding.com/viewtopic.php?pid=150229#p150229</id>
		</entry>
		<entry>
			<title type="html"><![CDATA[Re: AHK: неправильно работает код при русской раскладке клавиатуры]]></title>
			<link rel="alternate" href="https://forum.script-coding.com/viewtopic.php?pid=150228#p150228" />
			<content type="html"><![CDATA[<p><strong>__Михаил__</strong> увы, не сработало</p>]]></content>
			<author>
				<name><![CDATA[CyberGudini]]></name>
				<uri>https://forum.script-coding.com/profile.php?id=42079</uri>
			</author>
			<updated>2021-10-27T10:15:59Z</updated>
			<id>https://forum.script-coding.com/viewtopic.php?pid=150228#p150228</id>
		</entry>
		<entry>
			<title type="html"><![CDATA[Re: AHK: неправильно работает код при русской раскладке клавиатуры]]></title>
			<link rel="alternate" href="https://forum.script-coding.com/viewtopic.php?pid=150223#p150223" />
			<content type="html"><![CDATA[<p>На первых порах можно использовать без понимания. Нужно только получать объект Excel.Application<br /></p><div class="codebox"><pre><code>Excel := Excel_Get()

Excel_Get(WinTitle := &quot;ahk_class XLMAIN&quot;) {
   ControlGet, hwnd, hwnd,, Excel71, %WinTitle%
   if !hwnd
      return
   Window := AccObjectFromWindow(hwnd, -16)
   Loop {
      try Application := Window.Application
      catch
         ControlSend, Excel71, {esc}, %WinTitle%
   } Until !!Application
   return Application
}

AccObjectFromWindow(hWnd, idObject = 0)
{
   static IID_IDispatch   := &quot;{00020400-0000-0000-C000-000000000046}&quot;
        , IID_IAccessible := &quot;{618736E0-3C3D-11CF-810C-00AA00389B71}&quot;
        , OBJID_NATIVEOM  := 0xFFFFFFF0, VT_DISPATCH := 9, F_OWNVALUE := 1
        , h := DllCall(&quot;LoadLibrary&quot;, &quot;Str&quot;, &quot;oleacc&quot;, &quot;Ptr&quot;)
        
   VarSetCapacity(IID, 16), idObject &amp;= 0xFFFFFFFF
   DllCall(&quot;ole32\CLSIDFromString&quot;, &quot;Str&quot;, idObject = OBJID_NATIVEOM ? IID_IDispatch : IID_IAccessible, &quot;Ptr&quot;, &amp;IID)
   if DllCall(&quot;oleacc\AccessibleObjectFromWindow&quot;, &quot;Ptr&quot;, hWnd, &quot;UInt&quot;, idObject, &quot;Ptr&quot;, &amp;IID, &quot;PtrP&quot;, pAcc) = 0
      Return ComObjEnwrap(VT_DISPATCH, pAcc, F_OWNVALUE)
}</code></pre></div><p>и использовать его.<br />Ознакомьтесь, пожалуйста, с <a href="https://forum.script-coding.com/misc.php?action=rules">правилами</a>. Обратите внимание на <a href="https://forum.script-coding.com/misc.php?action=rules#literacy">точки</a> в конце предложений и правила <a href="https://forum.script-coding.com/misc.php?action=rules#quotation">цитирования</a>. Я отредактировал ваш пост.</p>]]></content>
			<author>
				<name><![CDATA[teadrinker]]></name>
				<uri>https://forum.script-coding.com/profile.php?id=24515</uri>
			</author>
			<updated>2021-10-26T21:43:59Z</updated>
			<id>https://forum.script-coding.com/viewtopic.php?pid=150223#p150223</id>
		</entry>
		<entry>
			<title type="html"><![CDATA[Re: AHK: неправильно работает код при русской раскладке клавиатуры]]></title>
			<link rel="alternate" href="https://forum.script-coding.com/viewtopic.php?pid=150222#p150222" />
			<content type="html"><![CDATA[<div class="quotebox"><cite>teadrinker пишет:</cite><blockquote><p>По идее ^c должно работать, если у вас последняя версия AHK.</p></blockquote></div><p>Да, версия старая. Нужно чтобы работало именно на старой версии, с установкой новой версии почему-то возникают проблемы.</p><div class="quotebox"><cite>teadrinker пишет:</cite><blockquote><p>А вообще лучше так:</p></blockquote></div><p>Уххх, ну прям хардкор какой-то. Понять бы еще это. <img src="//forum.script-coding.com/img/smilies/big_smile.png" width="15" height="15" /><br />Завтра, как попробую - отпишусь.</p>]]></content>
			<author>
				<name><![CDATA[CyberGudini]]></name>
				<uri>https://forum.script-coding.com/profile.php?id=42079</uri>
			</author>
			<updated>2021-10-26T21:34:51Z</updated>
			<id>https://forum.script-coding.com/viewtopic.php?pid=150222#p150222</id>
		</entry>
		<entry>
			<title type="html"><![CDATA[Re: AHK: неправильно работает код при русской раскладке клавиатуры]]></title>
			<link rel="alternate" href="https://forum.script-coding.com/viewtopic.php?pid=150220#p150220" />
			<content type="html"><![CDATA[<p>А вообще лучше так:<br /></p><div class="codebox"><pre><code>MsgBox, % GetSelectedCellText()      

GetSelectedCellText() {
   if !IsObject( Excel := Excel_Get() ) {
      MsgBox, Failed to get Excel Application object!
      return
   }
   Return Excel.Selection.Cells[1].text
}

Excel_Get(WinTitle := &quot;ahk_class XLMAIN&quot;) {
   ControlGet, hwnd, hwnd,, Excel71, %WinTitle%
   if !hwnd
      return
   Window := AccObjectFromWindow(hwnd, -16)
   Loop {
      try Application := Window.Application
      catch
         ControlSend, Excel71, {esc}, %WinTitle%
   } Until !!Application
   return Application
}

AccObjectFromWindow(hWnd, idObject = 0)
{
   static IID_IDispatch   := &quot;{00020400-0000-0000-C000-000000000046}&quot;
        , IID_IAccessible := &quot;{618736E0-3C3D-11CF-810C-00AA00389B71}&quot;
        , OBJID_NATIVEOM  := 0xFFFFFFF0, VT_DISPATCH := 9, F_OWNVALUE := 1
        , h := DllCall(&quot;LoadLibrary&quot;, &quot;Str&quot;, &quot;oleacc&quot;, &quot;Ptr&quot;)
        
   VarSetCapacity(IID, 16), idObject &amp;= 0xFFFFFFFF
   DllCall(&quot;ole32\CLSIDFromString&quot;, &quot;Str&quot;, idObject = OBJID_NATIVEOM ? IID_IDispatch : IID_IAccessible, &quot;Ptr&quot;, &amp;IID)
   if DllCall(&quot;oleacc\AccessibleObjectFromWindow&quot;, &quot;Ptr&quot;, hWnd, &quot;UInt&quot;, idObject, &quot;Ptr&quot;, &amp;IID, &quot;PtrP&quot;, pAcc) = 0
      Return ComObjEnwrap(VT_DISPATCH, pAcc, F_OWNVALUE)
}</code></pre></div>]]></content>
			<author>
				<name><![CDATA[teadrinker]]></name>
				<uri>https://forum.script-coding.com/profile.php?id=24515</uri>
			</author>
			<updated>2021-10-26T21:16:16Z</updated>
			<id>https://forum.script-coding.com/viewtopic.php?pid=150220#p150220</id>
		</entry>
		<entry>
			<title type="html"><![CDATA[Re: AHK: неправильно работает код при русской раскладке клавиатуры]]></title>
			<link rel="alternate" href="https://forum.script-coding.com/viewtopic.php?pid=150218#p150218" />
			<content type="html"><![CDATA[<p>По идее ^c должно работать, если у вас последняя версия AHK.</p>]]></content>
			<author>
				<name><![CDATA[teadrinker]]></name>
				<uri>https://forum.script-coding.com/profile.php?id=24515</uri>
			</author>
			<updated>2021-10-26T21:01:34Z</updated>
			<id>https://forum.script-coding.com/viewtopic.php?pid=150218#p150218</id>
		</entry>
		<entry>
			<title type="html"><![CDATA[Re: AHK: неправильно работает код при русской раскладке клавиатуры]]></title>
			<link rel="alternate" href="https://forum.script-coding.com/viewtopic.php?pid=150217#p150217" />
			<content type="html"><![CDATA[<p><strong>__Михаил__</strong> попробую, завтра напишу по результатам.<br />Я еще нашел такой вариант: <br /></p><div class="codebox"><pre><code>Send ^{vk43}</code></pre></div>]]></content>
			<author>
				<name><![CDATA[CyberGudini]]></name>
				<uri>https://forum.script-coding.com/profile.php?id=42079</uri>
			</author>
			<updated>2021-10-26T20:21:40Z</updated>
			<id>https://forum.script-coding.com/viewtopic.php?pid=150217#p150217</id>
		</entry>
		<entry>
			<title type="html"><![CDATA[Re: AHK: неправильно работает код при русской раскладке клавиатуры]]></title>
			<link rel="alternate" href="https://forum.script-coding.com/viewtopic.php?pid=150216#p150216" />
			<content type="html"><![CDATA[<p>Попробуйте так:<br /></p><div class="codebox"><pre><code>Send, ^{c}</code></pre></div>]]></content>
			<author>
				<name><![CDATA[__Михаил__]]></name>
				<uri>https://forum.script-coding.com/profile.php?id=40928</uri>
			</author>
			<updated>2021-10-26T18:01:24Z</updated>
			<id>https://forum.script-coding.com/viewtopic.php?pid=150216#p150216</id>
		</entry>
		<entry>
			<title type="html"><![CDATA[AHK: неправильно работает код при русской раскладке клавиатуры]]></title>
			<link rel="alternate" href="https://forum.script-coding.com/viewtopic.php?pid=150215#p150215" />
			<content type="html"><![CDATA[<p>Задача скопировать в буфер выделенную мышкой ячейку в excel. При англ. раскладке все отлично. Но при русской - сочетание alt+x срабатывает, однако скрипт вводит в ячейку символ &#039;c&#039; и неудачно её копирует (ErrorLevel). <br />Как исправить? <br />Код:<br /></p><div class="codebox"><pre><code>
!x::
	kd1 := &quot;&quot;
	Clipboard =         ;Сделать Буфер обмена пустым
	Send, ^c
	ClipWait, 2
	if ErrorLevel &lt;&gt; 0
	{
		MsgBox, Попытка скопировать текст в буфер обмена неудачна.
		Return
	}
	
	cl = %clipboard%
return
</code></pre></div>]]></content>
			<author>
				<name><![CDATA[CyberGudini]]></name>
				<uri>https://forum.script-coding.com/profile.php?id=42079</uri>
			</author>
			<updated>2021-10-26T17:55:58Z</updated>
			<id>https://forum.script-coding.com/viewtopic.php?pid=150215#p150215</id>
		</entry>
</feed>
