<?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=16201&amp;type=atom" />
	<updated>2021-03-22T23:43:03Z</updated>
	<generator>PunBB</generator>
	<id>https://forum.script-coding.com/viewtopic.php?id=16201</id>
		<entry>
			<title type="html"><![CDATA[Re: AHK: Как скопировать локальный файл в буфер обмена?]]></title>
			<link rel="alternate" href="https://forum.script-coding.com/viewtopic.php?pid=146887#p146887" />
			<content type="html"><![CDATA[<p>Вот так можно:<br /></p><div class="codebox"><pre><code>PutFileIntoClipboard(&quot;D:\MyFile.ext&quot;)

PutFileIntoClipboard(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><p>В качестве параметра функции может быть передан путь к одному либо пути к нескольким файлам, разделённые знаком переноса строки.</p>]]></content>
			<author>
				<name><![CDATA[teadrinker]]></name>
				<uri>https://forum.script-coding.com/profile.php?id=24515</uri>
			</author>
			<updated>2021-03-22T23:43:03Z</updated>
			<id>https://forum.script-coding.com/viewtopic.php?pid=146887#p146887</id>
		</entry>
		<entry>
			<title type="html"><![CDATA[AHK: Как скопировать локальный файл в буфер обмена?]]></title>
			<link rel="alternate" href="https://forum.script-coding.com/viewtopic.php?pid=146885#p146885" />
			<content type="html"><![CDATA[<p>Подскажите как скопировать файл с жесткого диска в буфер с помощью скрипта AHK?</p>]]></content>
			<author>
				<name><![CDATA[DrDron]]></name>
				<uri>https://forum.script-coding.com/profile.php?id=39496</uri>
			</author>
			<updated>2021-03-22T19:54:28Z</updated>
			<id>https://forum.script-coding.com/viewtopic.php?pid=146885#p146885</id>
		</entry>
</feed>
