<?xml version="1.0" encoding="utf-8"?>
<rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom">
	<channel>
		<title><![CDATA[Серый форум &mdash; AHK: Добавить папку в буфер обмена.]]></title>
		<link>https://forum.script-coding.com/viewtopic.php?id=17914</link>
		<atom:link href="https://forum.script-coding.com/extern.php?action=feed&amp;tid=17914&amp;type=rss" rel="self" type="application/rss+xml" />
		<description><![CDATA[Недавние сообщения в теме «AHK: Добавить папку в буфер обмена.».]]></description>
		<lastBuildDate>Sat, 19 Aug 2023 11:37:43 +0000</lastBuildDate>
		<generator>PunBB</generator>
		<item>
			<title><![CDATA[Re: AHK: Добавить папку в буфер обмена.]]></title>
			<link>https://forum.script-coding.com/viewtopic.php?pid=159053#p159053</link>
			<description><![CDATA[<p><strong>YMP</strong><br />Большое Вам спасибо.</p>]]></description>
			<author><![CDATA[null@example.com (D@rkSIDeR008)]]></author>
			<pubDate>Sat, 19 Aug 2023 11:37:43 +0000</pubDate>
			<guid>https://forum.script-coding.com/viewtopic.php?pid=159053#p159053</guid>
		</item>
		<item>
			<title><![CDATA[Re: AHK: Добавить папку в буфер обмена.]]></title>
			<link>https://forum.script-coding.com/viewtopic.php?pid=159052#p159052</link>
			<description><![CDATA[<p>Хм, а сейчас вообще странно, переписал то же самое заново в новом документе, и все заработало.</p>]]></description>
			<author><![CDATA[null@example.com (D@rkSIDeR008)]]></author>
			<pubDate>Sat, 19 Aug 2023 11:20:08 +0000</pubDate>
			<guid>https://forum.script-coding.com/viewtopic.php?pid=159052#p159052</guid>
		</item>
		<item>
			<title><![CDATA[Re: AHK: Добавить папку в буфер обмена.]]></title>
			<link>https://forum.script-coding.com/viewtopic.php?pid=159051#p159051</link>
			<description><![CDATA[<p>Вроде, все что мог лишнее убрал, думал мешает буфер обмена, добавил перед кодом:<br /></p><div class="codebox"><pre><code>Clipboard:= &quot;&quot;</code></pre></div><p>что бы почистить буфер обмена.<br />Но тоже не помогло.</p>]]></description>
			<author><![CDATA[null@example.com (D@rkSIDeR008)]]></author>
			<pubDate>Sat, 19 Aug 2023 11:02:46 +0000</pubDate>
			<guid>https://forum.script-coding.com/viewtopic.php?pid=159051#p159051</guid>
		</item>
		<item>
			<title><![CDATA[Re: AHK: Добавить папку в буфер обмена.]]></title>
			<link>https://forum.script-coding.com/viewtopic.php?pid=159050#p159050</link>
			<description><![CDATA[<div class="codebox"><pre><code>



PID:=DllCall(&quot;GetCurrentProcessId&quot;)
query:=&quot;SELECT Handle FROM Win32_Process WHERE Caption=&#039;AutoHotkey.exe&#039;&quot;

If (oWMI:=ComObjGet(&quot;winmgmts:&quot;).ExecQuery(query)).Count&gt;1
   For colItem In oWMI
      If colItem.Handle!=PID
         colItem.Terminate()



FileToClipboard(PathToCopy)
{
    ; Expand to full paths:
    temp_list := A_LoopFileLongPath &quot;`n&quot;

    Loop, Parse, PathToCopy, `n, `r
        Loop, %A_LoopField%, 1
            temp_list .= A_LoopFileLongPath &quot;`n&quot;
    PathToCopy := SubStr(temp_list, 1, -1)

    ; Allocate some movable memory to put on the clipboard.
    ; This will hold a DROPFILES struct and a null-terminated list of
    ; null-terminated strings.
    ; 0x42 = GMEM_MOVEABLE(0x2) | GMEM_ZEROINIT(0x40)
    hPath := DllCall(&quot;GlobalAlloc&quot;,&quot;uint&quot;,0x42,&quot;ptr&quot;,StrLen(PathToCopy)*2+24)

    ; Lock the moveable memory, retrieving a pointer to it.
    pPath := DllCall(&quot;GlobalLock&quot;,&quot;ptr&quot;,hPath)

    NumPut(20, pPath+0, 0, &quot;uint&quot;)  ; DROPFILES.pFiles = offset of file list
    NumPut(1, pPath+0, 16, &quot;uint&quot;)  ; File names are in Unicode.

    pPath += 20
    ; Copy the list of files into moveable memory.
    Loop, Parse, PathToCopy, `n, `r
    {
        DllCall(&quot;lstrcpyW&quot;,&quot;ptr&quot;,pPath+0,&quot;str&quot;,A_LoopField)
        pPath += (StrLen(A_LoopField)+1) * 2
    }

    ; Unlock the moveable memory.
    DllCall(&quot;GlobalUnlock&quot;,&quot;ptr&quot;,hPath)

    DllCall(&quot;OpenClipboard&quot;,&quot;ptr&quot;,0)
    ; Empty the clipboard, otherwise SetClipboardData may fail.
    DllCall(&quot;EmptyClipboard&quot;)
    ; Place the data on the clipboard. CF_HDROP=0xF
    DllCall(&quot;SetClipboardData&quot;,&quot;uint&quot;,0xF,&quot;ptr&quot;,hPath)
    DllCall(&quot;CloseClipboard&quot;)
}



Sleep, 200

CapsLock::

Q1 :=ClipboardAll
Sleep, 200

WinActivate, ahk_class Chrome_WidgetWin_1
Sleep, 350
  SendMessage, 0x50,, 0x4090409,, A ; английский
Sleep, 200
Click right
Sleep, 100
SetCapsLockState, off
Sleep, 550

ImageSearch, FoundX, FoundY, 1, 1, 1373, 732, %A_ScriptDir%\img\Save_ImageAs.png
sleep, 200
if ErrorLevel = 2
   {
    MsgBox Произвести поиск невозможно.
    Reload
   }
else if ErrorLevel = 1
   {
   MsgBox Изображение не найдено на экране.
    Reload
   }
else
   {
    Click %FoundX%, %FoundY%
   }

Sleep, 200
ControlSend,, {Right}{Down}, ahk_class Chrome_WidgetWin_1
Sleep, 350
ControlSend,, {Enter}, ahk_class Chrome_WidgetWin_1
Sleep, 200
WinWait, ahk_class #32770,
IfWinNotActive, ahk_class #32770, , WinActivate, ahk_class #32770,
WinWaitActive, ahk_class #32770,
Sleep, 200
  SendMessage, 0x50,, 0x4090409,, A ; английский
Sleep, 300
ControlSend,, {CTRLDOWN}c{CTRLUP}, ahk_class #32770
Sleep, 200
Q2 := ClipboardAll
Sleep, 200
DOWNLOAD:= &quot;C:\Users\User\Downloads\&quot;
Sleep, 200
ControlSend,, %DOWNLOAD%, ahk_class #32770
Sleep, 500
Send, {Enter}
Sleep, 200
ControlClick, x206 y82, ahk_class #32770
Sleep, 100
Send, {Space}
Sleep, 200
Clipboard:= Q1
Sleep, 350
Send, {CTRLDOWN}v{CTRLUP}
Sleep, 500
Send, {Enter}
Sleep, 200

IfWinActive, переименование
{
   Sleep, 300
   ControlSend,, {Enter}, переименование
   Sleep, 650
}

IfWinActive, Подтверждение замены папки
{
   Sleep, 300
   Send, {Enter}
   Sleep, 650
}

Send, {Enter}
Sleep, 200
ControlClick, x261 y373, Сохранение


Sleep, 350
Clipboard:= Q2
Sleep, 500
Send, {CTRLDOWN}v{CTRLUP}
Sleep, 500

WinActivate, ahk_class #32770
Sleep, 200
MouseClick, right,  378,  47
Sleep, 200
Send, {Down}{Down}{Enter}
Sleep, 200
Send, {Tab}
Sleep, 100
Send, {Tab}
Sleep, 500
FolderPath := Trim(Clipboard)
Sleep, 500

ControlClick, Со&amp;хранить, ahk_class #32770
Send, {Space}
Sleep, 500

Clipboard:= &quot;&quot;
Sleep, 200

FileToClipboard(FolderPath)

Sleep, 500
MsgBox, %FolderPath%

</code></pre></div>]]></description>
			<author><![CDATA[null@example.com (D@rkSIDeR008)]]></author>
			<pubDate>Sat, 19 Aug 2023 11:00:41 +0000</pubDate>
			<guid>https://forum.script-coding.com/viewtopic.php?pid=159050#p159050</guid>
		</item>
		<item>
			<title><![CDATA[Re: AHK: Добавить папку в буфер обмена.]]></title>
			<link>https://forum.script-coding.com/viewtopic.php?pid=159049#p159049</link>
			<description><![CDATA[<p>Интересно, в отдельном скрипте это все работает и копирует, но как только я его добавляю в общий скрипт, большой, то он перестает копировать.</p>]]></description>
			<author><![CDATA[null@example.com (D@rkSIDeR008)]]></author>
			<pubDate>Sat, 19 Aug 2023 10:56:58 +0000</pubDate>
			<guid>https://forum.script-coding.com/viewtopic.php?pid=159049#p159049</guid>
		</item>
		<item>
			<title><![CDATA[Re: AHK: Добавить папку в буфер обмена.]]></title>
			<link>https://forum.script-coding.com/viewtopic.php?pid=159048#p159048</link>
			<description><![CDATA[<div class="quotebox"><cite>D@rkSIDeR008 пишет:</cite><blockquote><div class="codebox"><pre><code>FileToClipboard(&quot;%FolderPath%&quot;)</code></pre></div></blockquote></div><p>Не, надо так:<br /></p><div class="codebox"><pre><code>
FileToClipboard(FolderPath)
</code></pre></div><p>Функциям нужно просто имя переменной, без процентов и кавычек.</p>]]></description>
			<author><![CDATA[null@example.com (YMP)]]></author>
			<pubDate>Sat, 19 Aug 2023 09:50:01 +0000</pubDate>
			<guid>https://forum.script-coding.com/viewtopic.php?pid=159048#p159048</guid>
		</item>
		<item>
			<title><![CDATA[Re: AHK: Добавить папку в буфер обмена.]]></title>
			<link>https://forum.script-coding.com/viewtopic.php?pid=159047#p159047</link>
			<description><![CDATA[<p>Да, действительно через переменную, не вставляется путь в FileToClipboard(PathToCopy).<br />Я переделал немного код для проверки:<br /></p><div class="codebox"><pre><code>FolderPath := &quot;C:\Users\User\Downloads\Диван Лайм 2-х местный мод 337968 Era cotton орех лак (РФ)&quot;
Sleep, 500

MsgBox, %FolderPath%


FileToClipboard(&quot;%FolderPath%&quot;)

FileToClipboard(PathToCopy)
{
    ; Expand to full paths:
    Loop, Parse, PathToCopy, `n, `r
        Loop, %A_LoopField%, 1
            temp_list .= A_LoopFileLongPath &quot;`n&quot;
    PathToCopy := SubStr(temp_list, 1, -1)

    ; Allocate some movable memory to put on the clipboard.
    ; This will hold a DROPFILES struct and a null-terminated list of
    ; null-terminated strings.
    ; 0x42 = GMEM_MOVEABLE(0x2) | GMEM_ZEROINIT(0x40)
    hPath := DllCall(&quot;GlobalAlloc&quot;,&quot;uint&quot;,0x42,&quot;ptr&quot;,StrLen(PathToCopy)*2+24)

    ; Lock the moveable memory, retrieving a pointer to it.
    pPath := DllCall(&quot;GlobalLock&quot;,&quot;ptr&quot;,hPath)

    NumPut(20, pPath+0, 0, &quot;uint&quot;)  ; DROPFILES.pFiles = offset of file list
    NumPut(1, pPath+0, 16, &quot;uint&quot;)  ; File names are in Unicode.

    pPath += 20
    ; Copy the list of files into moveable memory.
    Loop, Parse, PathToCopy, `n, `r
    {
        DllCall(&quot;lstrcpyW&quot;,&quot;ptr&quot;,pPath+0,&quot;str&quot;,A_LoopField)
        pPath += (StrLen(A_LoopField)+1) * 2
    }

    ; Unlock the moveable memory.
    DllCall(&quot;GlobalUnlock&quot;,&quot;ptr&quot;,hPath)

    DllCall(&quot;OpenClipboard&quot;,&quot;ptr&quot;,0)
    ; Empty the clipboard, otherwise SetClipboardData may fail.
    DllCall(&quot;EmptyClipboard&quot;)
    ; Place the data on the clipboard. CF_HDROP=0xF
    DllCall(&quot;SetClipboardData&quot;,&quot;uint&quot;,0xF,&quot;ptr&quot;,hPath)
    DllCall(&quot;CloseClipboard&quot;)
}</code></pre></div><p>вот так не работает.<br />Ну по крайней мере у меня.</p>]]></description>
			<author><![CDATA[null@example.com (D@rkSIDeR008)]]></author>
			<pubDate>Sat, 19 Aug 2023 09:29:50 +0000</pubDate>
			<guid>https://forum.script-coding.com/viewtopic.php?pid=159047#p159047</guid>
		</item>
		<item>
			<title><![CDATA[Re: AHK: Добавить папку в буфер обмена.]]></title>
			<link>https://forum.script-coding.com/viewtopic.php?pid=159046#p159046</link>
			<description><![CDATA[<p>Либо так нельзя делать, я проверил написал до кода копирования MsBox и в нем выдает правильный путь, но он не вставляется дальше, потому что я проверил буфер обмена другим скриптом:<br /></p><div class="codebox"><pre><code>FileAppend, %ClipboardAll%, 1.txt ;</code></pre></div><p>и там почти пустой файл выходит, без путей. Обычно когда копируешь папку, она в текстовом документе записывает кучу символов и 3 раза путь к папке, 2 раза с пробелами между каждым символом и 1 раз обычно, ну это как я понял по крайней мере.</p>]]></description>
			<author><![CDATA[null@example.com (D@rkSIDeR008)]]></author>
			<pubDate>Sat, 19 Aug 2023 09:22:31 +0000</pubDate>
			<guid>https://forum.script-coding.com/viewtopic.php?pid=159046#p159046</guid>
		</item>
		<item>
			<title><![CDATA[Re: AHK: Добавить папку в буфер обмена.]]></title>
			<link>https://forum.script-coding.com/viewtopic.php?pid=159045#p159045</link>
			<description><![CDATA[<p>Спасибо, я обновил AHK заработало.<br />Но у меня путь к папке в буфере обмена.<br /></p><div class="codebox"><pre><code>FolderPath := Trim(Clipboard)
Sleep, 500

ControlClick, Со&amp;хранить, ahk_class #32770
Send, {Space}
Sleep, 500

FileToClipboard(&quot;%FolderPath%&quot;)

FileToClipboard(PathToCopy)
{
    ; Expand to full paths:
    Loop, Parse, PathToCopy, `n, `r
        Loop, %A_LoopField%, 1
            temp_list .= A_LoopFileLongPath &quot;`n&quot;
    PathToCopy := SubStr(temp_list, 1, -1)

    ; Allocate some movable memory to put on the clipboard.
    ; This will hold a DROPFILES struct and a null-terminated list of
    ; null-terminated strings.
    ; 0x42 = GMEM_MOVEABLE(0x2) | GMEM_ZEROINIT(0x40)
    hPath := DllCall(&quot;GlobalAlloc&quot;,&quot;uint&quot;,0x42,&quot;ptr&quot;,StrLen(PathToCopy)*2+24)

    ; Lock the moveable memory, retrieving a pointer to it.
    pPath := DllCall(&quot;GlobalLock&quot;,&quot;ptr&quot;,hPath)

    NumPut(20, pPath+0, 0, &quot;uint&quot;)  ; DROPFILES.pFiles = offset of file list
    NumPut(1, pPath+0, 16, &quot;uint&quot;)  ; File names are in Unicode.

    pPath += 20
    ; Copy the list of files into moveable memory.
    Loop, Parse, PathToCopy, `n, `r
    {
        DllCall(&quot;lstrcpyW&quot;,&quot;ptr&quot;,pPath+0,&quot;str&quot;,A_LoopField)
        pPath += (StrLen(A_LoopField)+1) * 2
    }

    ; Unlock the moveable memory.
    DllCall(&quot;GlobalUnlock&quot;,&quot;ptr&quot;,hPath)

    DllCall(&quot;OpenClipboard&quot;,&quot;ptr&quot;,0)
    ; Empty the clipboard, otherwise SetClipboardData may fail.
    DllCall(&quot;EmptyClipboard&quot;)
    ; Place the data on the clipboard. CF_HDROP=0xF
    DllCall(&quot;SetClipboardData&quot;,&quot;uint&quot;,0xF,&quot;ptr&quot;,hPath)
    DllCall(&quot;CloseClipboard&quot;)
}</code></pre></div><p>То есть я копирую путь к папке и открываю скрипт, но видимо что то не так вставляется.</p>]]></description>
			<author><![CDATA[null@example.com (D@rkSIDeR008)]]></author>
			<pubDate>Sat, 19 Aug 2023 09:10:39 +0000</pubDate>
			<guid>https://forum.script-coding.com/viewtopic.php?pid=159045#p159045</guid>
		</item>
		<item>
			<title><![CDATA[Re: AHK: Добавить папку в буфер обмена.]]></title>
			<link>https://forum.script-coding.com/viewtopic.php?pid=159044#p159044</link>
			<description><![CDATA[<p>И на Windows 7 SP1 работает.</p>]]></description>
			<author><![CDATA[null@example.com (YMP)]]></author>
			<pubDate>Sat, 19 Aug 2023 08:50:37 +0000</pubDate>
			<guid>https://forum.script-coding.com/viewtopic.php?pid=159044#p159044</guid>
		</item>
		<item>
			<title><![CDATA[Re: AHK: Добавить папку в буфер обмена.]]></title>
			<link>https://forum.script-coding.com/viewtopic.php?pid=159043#p159043</link>
			<description><![CDATA[<p>У меня старее была, а последняя уже&nbsp; 1.1.37.01. Обновил до неё, всё равно всё работает. Проверил ещё на Windows XP SP3, тоже работает. Не знаю, что у вас может быть.</p>]]></description>
			<author><![CDATA[null@example.com (YMP)]]></author>
			<pubDate>Sat, 19 Aug 2023 08:40:32 +0000</pubDate>
			<guid>https://forum.script-coding.com/viewtopic.php?pid=159043#p159043</guid>
		</item>
		<item>
			<title><![CDATA[Re: AHK: Добавить папку в буфер обмена.]]></title>
			<link>https://forum.script-coding.com/viewtopic.php?pid=159042#p159042</link>
			<description><![CDATA[<p><strong>YMP</strong><br />U64 1.1.36.02</p>]]></description>
			<author><![CDATA[null@example.com (D@rkSIDeR008)]]></author>
			<pubDate>Sat, 19 Aug 2023 08:18:04 +0000</pubDate>
			<guid>https://forum.script-coding.com/viewtopic.php?pid=159042#p159042</guid>
		</item>
		<item>
			<title><![CDATA[Re: AHK: Добавить папку в буфер обмена.]]></title>
			<link>https://forum.script-coding.com/viewtopic.php?pid=159041#p159041</link>
			<description><![CDATA[<p>Так что там скидывать? Код тот же, что выше в моём посте, я оттуда скопировал. В первой строчке, где вызов функции, вставил вместо PathToCopy путь к папке.</p><p>Что у вас вот этот код показывает про ваш АНК?<br /></p><div class="codebox"><pre><code>
MsgBox, % (A_IsUnicode ? &quot;U&quot;:&quot;A&quot;) . (A_PtrSize == 8 ? 64:32) . &quot; &quot; . A_AhkVersion
</code></pre></div>]]></description>
			<author><![CDATA[null@example.com (YMP)]]></author>
			<pubDate>Sat, 19 Aug 2023 08:13:33 +0000</pubDate>
			<guid>https://forum.script-coding.com/viewtopic.php?pid=159041#p159041</guid>
		</item>
		<item>
			<title><![CDATA[Re: AHK: Добавить папку в буфер обмена.]]></title>
			<link>https://forum.script-coding.com/viewtopic.php?pid=159040#p159040</link>
			<description><![CDATA[<p>Не могли бы вы скинуть код, где вы вставили в скрипт путь к папке.</p>]]></description>
			<author><![CDATA[null@example.com (D@rkSIDeR008)]]></author>
			<pubDate>Sat, 19 Aug 2023 07:42:45 +0000</pubDate>
			<guid>https://forum.script-coding.com/viewtopic.php?pid=159040#p159040</guid>
		</item>
		<item>
			<title><![CDATA[Re: AHK: Добавить папку в буфер обмена.]]></title>
			<link>https://forum.script-coding.com/viewtopic.php?pid=159039#p159039</link>
			<description><![CDATA[<div class="quotebox"><cite>YMP пишет:</cite><blockquote><p><strong>D@rkSIDeR008</strong><br />Проверил ещё раз, скопировав код из моего поста выше, у меня работает и для файлов, и для папок. На Windows 10.</p><p>У вас АНК какой?</p></blockquote></div><p>У меня WIN8.1, а AHK&nbsp; я обе версии поставил, но что бы работала 2ая вроде нужно в начале скрипта указывать, значит работает первая версия, но она у меня последняя, я с сайта недавно качал.</p>]]></description>
			<author><![CDATA[null@example.com (D@rkSIDeR008)]]></author>
			<pubDate>Sat, 19 Aug 2023 07:41:23 +0000</pubDate>
			<guid>https://forum.script-coding.com/viewtopic.php?pid=159039#p159039</guid>
		</item>
	</channel>
</rss>
