<?xml version="1.0" encoding="utf-8"?>
<rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom">
	<channel>
		<title><![CDATA[Серый форум &mdash; AHK: Copy, Paste, назначенные на боковые кнопки мыши не видят объекты]]></title>
		<link>https://forum.script-coding.com/viewtopic.php?id=16691</link>
		<atom:link href="https://forum.script-coding.com/extern.php?action=feed&amp;tid=16691&amp;type=rss" rel="self" type="application/rss+xml" />
		<description><![CDATA[Недавние сообщения в теме «AHK: Copy, Paste, назначенные на боковые кнопки мыши не видят объекты».]]></description>
		<lastBuildDate>Thu, 28 Oct 2021 16:00:48 +0000</lastBuildDate>
		<generator>PunBB</generator>
		<item>
			<title><![CDATA[Re: AHK: Copy, Paste, назначенные на боковые кнопки мыши не видят объекты]]></title>
			<link>https://forum.script-coding.com/viewtopic.php?pid=150280#p150280</link>
			<description><![CDATA[<p>Вот теперь четко, спасибо! Код из #7 работает так как надо. Теперь попробую еще погонять его в разных окнах и условиях потом напишу, если будут шероховатости.</p>]]></description>
			<author><![CDATA[null@example.com (alpap)]]></author>
			<pubDate>Thu, 28 Oct 2021 16:00:48 +0000</pubDate>
			<guid>https://forum.script-coding.com/viewtopic.php?pid=150280#p150280</guid>
		</item>
		<item>
			<title><![CDATA[Re: AHK: Copy, Paste, назначенные на боковые кнопки мыши не видят объекты]]></title>
			<link>https://forum.script-coding.com/viewtopic.php?pid=150279#p150279</link>
			<description><![CDATA[<p>Добавил к коду из #5 строку<br /></p><div class="codebox"><pre><code>
XButton1:: send {LCtrl Down}V{LCtrl Up}
</code></pre></div><p>теперь копирует объекты в том количестве сколько выделено, т.е. правильно, вставить по XButton1, естественно не получается и все также нет теперь работы с текстом.</p>]]></description>
			<author><![CDATA[null@example.com (alpap)]]></author>
			<pubDate>Thu, 28 Oct 2021 15:56:57 +0000</pubDate>
			<guid>https://forum.script-coding.com/viewtopic.php?pid=150279#p150279</guid>
		</item>
		<item>
			<title><![CDATA[Re: AHK: Copy, Paste, назначенные на боковые кнопки мыши не видят объекты]]></title>
			<link>https://forum.script-coding.com/viewtopic.php?pid=150278#p150278</link>
			<description><![CDATA[<div class="quotebox"><cite>alpap пишет:</cite><blockquote><p>вставляется только один последний объект</p></blockquote></div><p>Так не должно быть, у меня вставляется всё выделенное.<br /></p><div class="quotebox"><cite>alpap пишет:</cite><blockquote><p>теперь не работает с текстом</p></blockquote></div><p>Чтобы работало и с файлами, и с текстом, можно так:<br /></p><div class="codebox"><pre><code>XButton2::
   if fileList := Explorer_GetSelection()
      PutFilesIntoClipboard(fileList)
   else
      Send ^c
   Return
XButton1:: Send ^v

Explorer_GetSelection() {
   WinGetClass, winClass, % &quot;ahk_id&quot; . hWnd := WinExist(&quot;A&quot;)
   if !(winClass ~= &quot;^(Progman|WorkerW|(Cabinet|Explore)WClass)$&quot;)
      Return
   
   shellWindows := ComObjCreate(&quot;Shell.Application&quot;).Windows
   if (winClass ~= &quot;Progman|WorkerW&quot;)  ; IShellWindows::Item:    https://goo.gl/ihW9Gm
                                       ; IShellFolderViewDual:   https://goo.gl/gnntq3
      shellFolderView := shellWindows.Item( ComObject(VT_UI4 := 0x13, SWC_DESKTOP := 0x8) ).Document
   else {
      for window in shellWindows       ; ShellFolderView object: https://is.gd/eyZ4zG
         if (hWnd = window.HWND) &amp;&amp; (shellFolderView := window.Document)
            break
   }
   for item in shellFolderView.SelectedItems
      result .= (result = &quot;&quot; ? &quot;&quot; : &quot;`n&quot;) . item.Path
   Return result
}

PutFilesIntoClipboard(fileList) {
   static GHND := 0x42, CF_HDROP := 0xF
   fileList := Trim( RegExReplace(fileList, &quot;\R&quot;, &quot;`n&quot;), &quot; `t`r`n&quot; ), RegExReplace(fileList, &quot;\R&quot;, &quot;&quot;, count)
   VarSetCapacity(DROPFILES, size := 20 + StrLen(fileList) + count + 2, 0)
   NumPut(20, DROPFILES)
   prevLen := 0
   Loop, parse, fileList, `n
      prevLen += StrPut(A_LoopField, &amp;DROPFILES + 20 + prevLen + A_Index - 1, StrLen(A_LoopField), &quot;CP0&quot;)
   hMem := DllCall(&quot;GlobalAlloc&quot;, &quot;UInt&quot;, GHND, &quot;Ptr&quot;, size, &quot;Ptr&quot;)
   pData := DllCall(&quot;GlobalLock&quot;, &quot;Ptr&quot;, hMem, &quot;Ptr&quot;)
   DllCall(&quot;RtlMoveMemory&quot;, &quot;Ptr&quot;, pData, &quot;Ptr&quot;, &amp;DROPFILES, &quot;Ptr&quot;, size)
   DllCall(&quot;GlobalUnlock&quot;, &quot;Ptr&quot;, hMem)
   DllCall(&quot;OpenClipboard&quot;, &quot;Ptr&quot;, 0)
   DllCall(&quot;SetClipboardData&quot;, &quot;UInt&quot;, CF_HDROP, &quot;Ptr&quot;, hMem)
   DllCall(&quot;CloseClipboard&quot;)
}</code></pre></div>]]></description>
			<author><![CDATA[null@example.com (teadrinker)]]></author>
			<pubDate>Thu, 28 Oct 2021 15:52:44 +0000</pubDate>
			<guid>https://forum.script-coding.com/viewtopic.php?pid=150278#p150278</guid>
		</item>
		<item>
			<title><![CDATA[Re: AHK: Copy, Paste, назначенные на боковые кнопки мыши не видят объекты]]></title>
			<link>https://forum.script-coding.com/viewtopic.php?pid=150277#p150277</link>
			<description><![CDATA[<p>Так XButton2 копирует файлы и/или папки, но если вставить, то вставляется только один последний объект (выделяем &quot;aaa1&quot;, &quot;aaa2&quot;, копируем, вставляем в новое место, на выходе - только &quot;aaa2&quot;). И так включилась противоположная проблема - теперь не работает с текстом.</p>]]></description>
			<author><![CDATA[null@example.com (alpap)]]></author>
			<pubDate>Thu, 28 Oct 2021 15:46:29 +0000</pubDate>
			<guid>https://forum.script-coding.com/viewtopic.php?pid=150277#p150277</guid>
		</item>
		<item>
			<title><![CDATA[Re: AHK: Copy, Paste, назначенные на боковые кнопки мыши не видят объекты]]></title>
			<link>https://forum.script-coding.com/viewtopic.php?pid=150275#p150275</link>
			<description><![CDATA[<p>Попробуйте так:<br /></p><div class="codebox"><pre><code>XButton2:: PutFilesIntoClipboard( Explorer_GetSelection() )

Explorer_GetSelection() {
   WinGetClass, winClass, % &quot;ahk_id&quot; . hWnd := WinExist(&quot;A&quot;)
   if !(winClass ~= &quot;^(Progman|WorkerW|(Cabinet|Explore)WClass)$&quot;)
      Return
   
   shellWindows := ComObjCreate(&quot;Shell.Application&quot;).Windows
   if (winClass ~= &quot;Progman|WorkerW&quot;)  ; IShellWindows::Item:    https://goo.gl/ihW9Gm
                                       ; IShellFolderViewDual:   https://goo.gl/gnntq3
      shellFolderView := shellWindows.Item( ComObject(VT_UI4 := 0x13, SWC_DESKTOP := 0x8) ).Document
   else {
      for window in shellWindows       ; ShellFolderView object: https://is.gd/eyZ4zG
         if (hWnd = window.HWND) &amp;&amp; (shellFolderView := window.Document)
            break
   }
   for item in shellFolderView.SelectedItems
      result .= (result = &quot;&quot; ? &quot;&quot; : &quot;`n&quot;) . item.Path
   Return result
}

PutFilesIntoClipboard(fileList) {
   static GHND := 0x42, CF_HDROP := 0xF
   fileList := Trim( RegExReplace(fileList, &quot;\R&quot;, &quot;`n&quot;), &quot; `t`r`n&quot; ), RegExReplace(fileList, &quot;\R&quot;, &quot;&quot;, count)
   VarSetCapacity(DROPFILES, size := 20 + StrLen(fileList) + count + 2, 0)
   NumPut(20, DROPFILES)
   prevLen := 0
   Loop, parse, fileList, `n
      prevLen += StrPut(A_LoopField, &amp;DROPFILES + 20 + prevLen + A_Index - 1, StrLen(A_LoopField), &quot;CP0&quot;)
   hMem := DllCall(&quot;GlobalAlloc&quot;, &quot;UInt&quot;, GHND, &quot;Ptr&quot;, size, &quot;Ptr&quot;)
   pData := DllCall(&quot;GlobalLock&quot;, &quot;Ptr&quot;, hMem, &quot;Ptr&quot;)
   DllCall(&quot;RtlMoveMemory&quot;, &quot;Ptr&quot;, pData, &quot;Ptr&quot;, &amp;DROPFILES, &quot;Ptr&quot;, size)
   DllCall(&quot;GlobalUnlock&quot;, &quot;Ptr&quot;, hMem)
   DllCall(&quot;OpenClipboard&quot;, &quot;Ptr&quot;, 0)
   DllCall(&quot;SetClipboardData&quot;, &quot;UInt&quot;, CF_HDROP, &quot;Ptr&quot;, hMem)
   DllCall(&quot;CloseClipboard&quot;)
}</code></pre></div>]]></description>
			<author><![CDATA[null@example.com (teadrinker)]]></author>
			<pubDate>Thu, 28 Oct 2021 15:23:21 +0000</pubDate>
			<guid>https://forum.script-coding.com/viewtopic.php?pid=150275#p150275</guid>
		</item>
		<item>
			<title><![CDATA[Re: AHK: Copy, Paste, назначенные на боковые кнопки мыши не видят объекты]]></title>
			<link>https://forum.script-coding.com/viewtopic.php?pid=150273#p150273</link>
			<description><![CDATA[<p><strong>alpap</strong>, ознакомьтесь, пожалуйста, с <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> в начале предложений.</p>]]></description>
			<author><![CDATA[null@example.com (teadrinker)]]></author>
			<pubDate>Thu, 28 Oct 2021 15:12:05 +0000</pubDate>
			<guid>https://forum.script-coding.com/viewtopic.php?pid=150273#p150273</guid>
		</item>
		<item>
			<title><![CDATA[Re: AHK: Copy, Paste, назначенные на боковые кнопки мыши не видят объекты]]></title>
			<link>https://forum.script-coding.com/viewtopic.php?pid=150272#p150272</link>
			<description><![CDATA[<div class="quotebox"><blockquote><p>если назначать на другие горячие клавиши</p></blockquote></div><p>Я как-то и не подумал попробовать ...<br />Попробовал - то же самое, копировать-вставить с помощью назначенных горячих клавиш получается только текст.</p>]]></description>
			<author><![CDATA[null@example.com (alpap)]]></author>
			<pubDate>Thu, 28 Oct 2021 15:10:32 +0000</pubDate>
			<guid>https://forum.script-coding.com/viewtopic.php?pid=150272#p150272</guid>
		</item>
		<item>
			<title><![CDATA[Re: AHK: Copy, Paste, назначенные на боковые кнопки мыши не видят объекты]]></title>
			<link>https://forum.script-coding.com/viewtopic.php?pid=150271#p150271</link>
			<description><![CDATA[<div class="quotebox"><cite>alpap пишет:</cite><blockquote><p>Copy, Paste, назначенные на боковые кнопки мыши не видят объекты</p></blockquote></div><p>То-есть, если назначать на другие горячие клавиши, то нет проблем?</p>]]></description>
			<author><![CDATA[null@example.com (teadrinker)]]></author>
			<pubDate>Thu, 28 Oct 2021 14:57:30 +0000</pubDate>
			<guid>https://forum.script-coding.com/viewtopic.php?pid=150271#p150271</guid>
		</item>
		<item>
			<title><![CDATA[AHK: Copy, Paste, назначенные на боковые кнопки мыши не видят объекты]]></title>
			<link>https://forum.script-coding.com/viewtopic.php?pid=150267#p150267</link>
			<description><![CDATA[<p>День добрый!<br />При использовании такого скрипта:<br /></p><div class="codebox"><pre><code>
XButton2:: send {LCtrl Down}C{LCtrl Up}
XButton1:: send {LCtrl Down}V{LCtrl Up}
</code></pre></div><p>Т.е. на горячие боковые клавиши (4 и 5) назначены стандартные клавиатурные Copy (Ctrl+C), Paste (Ctrl+V).<br />Это работает, но только с текстом.<br />А вот копировать-вставить файлы или папки - увы. Те же комбинации Copy (Ctrl+C), Paste (Ctrl+V), назначенные с помощью программы &quot;Key Manager&quot;, работают везде и как с текстом так и объектами.<br />Есть какой-то выход при использовании AHK в данном случае?</p>]]></description>
			<author><![CDATA[null@example.com (alpap)]]></author>
			<pubDate>Thu, 28 Oct 2021 13:37:10 +0000</pubDate>
			<guid>https://forum.script-coding.com/viewtopic.php?pid=150267#p150267</guid>
		</item>
	</channel>
</rss>
