<?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=10827</link>
		<atom:link href="https://forum.script-coding.com/extern.php?action=feed&amp;tid=10827&amp;type=rss" rel="self" type="application/rss+xml" />
		<description><![CDATA[Недавние сообщения в теме «AHK: Перенос выделенного файла в папку».]]></description>
		<lastBuildDate>Tue, 09 Apr 2024 05:21:33 +0000</lastBuildDate>
		<generator>PunBB</generator>
		<item>
			<title><![CDATA[Re: AHK: Перенос выделенного файла в папку]]></title>
			<link>https://forum.script-coding.com/viewtopic.php?pid=160770#p160770</link>
			<description><![CDATA[<p>Используйте мой вариант с буфером обмена.</p>]]></description>
			<author><![CDATA[null@example.com (Malcev)]]></author>
			<pubDate>Tue, 09 Apr 2024 05:21:33 +0000</pubDate>
			<guid>https://forum.script-coding.com/viewtopic.php?pid=160770#p160770</guid>
		</item>
		<item>
			<title><![CDATA[Re: AHK: Перенос выделенного файла в папку]]></title>
			<link>https://forum.script-coding.com/viewtopic.php?pid=160768#p160768</link>
			<description><![CDATA[<p><strong>teadrinker</strong>, когда в момент просмотра через средство просмотра фотографий Windows нажимаю F10/F11, то картинка не отправляется в папку и выскакивают кракозябры</p>]]></description>
			<author><![CDATA[null@example.com (RoboMilk)]]></author>
			<pubDate>Mon, 08 Apr 2024 15:18:19 +0000</pubDate>
			<guid>https://forum.script-coding.com/viewtopic.php?pid=160768#p160768</guid>
		</item>
		<item>
			<title><![CDATA[Re: AHK: Перенос выделенного файла в папку]]></title>
			<link>https://forum.script-coding.com/viewtopic.php?pid=160761#p160761</link>
			<description><![CDATA[<p>Чтобы не было кракозябров, сохраняйте скрипт в кодировке UTF-8 с BOM. Не уверен, что точно понял, что у вас происходит, но предполагаю, что вы пытаетесь перенести файл, который открыт в каком-то приложении. Этого сделать не получится.</p>]]></description>
			<author><![CDATA[null@example.com (teadrinker)]]></author>
			<pubDate>Sun, 07 Apr 2024 14:45:14 +0000</pubDate>
			<guid>https://forum.script-coding.com/viewtopic.php?pid=160761#p160761</guid>
		</item>
		<item>
			<title><![CDATA[Re: AHK: Перенос выделенного файла в папку]]></title>
			<link>https://forum.script-coding.com/viewtopic.php?pid=160760#p160760</link>
			<description><![CDATA[<p><strong>teadrinker</strong>, здравствуйте!<br />Код работает, но не работает, если нажать на F10 или F11, когда файл (.png .jpg) просматривается в активном окне.<br />Можете, пожалуйста, код улучшить?</p>]]></description>
			<author><![CDATA[null@example.com (RoboMilk)]]></author>
			<pubDate>Sun, 07 Apr 2024 10:17:46 +0000</pubDate>
			<guid>https://forum.script-coding.com/viewtopic.php?pid=160760#p160760</guid>
		</item>
		<item>
			<title><![CDATA[Re: AHK: Перенос выделенного файла в папку]]></title>
			<link>https://forum.script-coding.com/viewtopic.php?pid=97107#p97107</link>
			<description><![CDATA[<div class="codebox"><pre><code>KeysAndFolders := {F10: A_Desktop &quot;\MyFirstFolder&quot;, F11: A_Desktop &quot;\MySecondFolder&quot;}
F10::
F11::
   if !paths := GetSelected()  {
      MsgBox, Выделенные файлы не найдены!
      Return
   }
   if !FileExist(dir := KeysAndFolders[A_ThisHotkey])
      FileCreateDir, % dir
   
   Loop, parse, paths, `n
   {
      if !InStr(FileExist(A_LoopField), &quot;D&quot;)
         FileMove, % A_LoopField, % dir
      else {
         SplitPath, A_LoopField, DirName
         FileMoveDir, % A_LoopField, % dir &quot;\&quot; DirName
      }
   }
   PostMessage, WM_COMMAND := 0x111, Refresh := 41504,,, % &quot;ahk_id&quot; HWND_BROADCAST := 0xFFFF
   Return

GetSelected(hwnd=&quot;&quot;)
{
   if (hwnd = &quot;&quot;)
      WinGet, hwnd,, A
   
   WinGetClass class, ahk_id %hwnd%
   
   if (class ~= &quot;(Cabinet|Explore)WClass&quot;)  {
      for window in ComObjCreate(&quot;Shell.Application&quot;).Windows
         if (window.hwnd = hwnd &amp;&amp; found := 1)
            break

      if !found
         return

      for item in window.document.SelectedItems
         paths .= item.path &quot;`n&quot;
   }
   
   else if (class ~= &quot;Progman|WorkerW&quot;)  {
      for item in GetDesktopIShellFolderViewDual().SelectedItems
         paths .= item.path . &quot;`n&quot;
   }
   Return Trim(paths, &quot;`n&quot;)
}

GetDesktopIShellFolderViewDual()
{
    IShellWindows := ComObjCreate(&quot;{9BA05972-F6A8-11CF-A442-00A0C90A8F39}&quot;)
    desktop := IShellWindows.Item(ComObj(19, 8)) ; VT_UI4, SCW_DESKTOP                
   
    ; Retrieve top-level browser object.
    if ptlb := ComObjQuery(desktop
        , &quot;{4C96BE40-915C-11CF-99D3-00AA004AE837}&quot;  ; SID_STopLevelBrowser
        , &quot;{000214E2-0000-0000-C000-000000000046}&quot;) ; IID_IShellBrowser
    {
        ; IShellBrowser.QueryActiveShellView -&gt; IShellView
        if DllCall(NumGet(NumGet(ptlb+0)+15*A_PtrSize), &quot;ptr&quot;, ptlb, &quot;ptr*&quot;, psv) = 0
        {
            ; Define IID_IDispatch.
            VarSetCapacity(IID_IDispatch, 16)
            NumPut(0x46000000000000C0, NumPut(0x20400, IID_IDispatch, &quot;int64&quot;), &quot;int64&quot;)
           
            ; IShellView.GetItemObject -&gt; IDispatch (object which implements IShellFolderViewDual)
            DllCall(NumGet(NumGet(psv+0)+15*A_PtrSize), &quot;ptr&quot;, psv
                , &quot;uint&quot;, 0, &quot;ptr&quot;, &amp;IID_IDispatch, &quot;ptr*&quot;, pdisp)
           
            IShellFolderViewDual := ComObjEnwrap(pdisp)
            ObjRelease(psv)
        }
        ObjRelease(ptlb)
    }
    return IShellFolderViewDual
}</code></pre></div>]]></description>
			<author><![CDATA[null@example.com (teadrinker)]]></author>
			<pubDate>Sat, 05 Sep 2015 06:35:38 +0000</pubDate>
			<guid>https://forum.script-coding.com/viewtopic.php?pid=97107#p97107</guid>
		</item>
		<item>
			<title><![CDATA[Re: AHK: Перенос выделенного файла в папку]]></title>
			<link>https://forum.script-coding.com/viewtopic.php?pid=97105#p97105</link>
			<description><![CDATA[<p>Teadrinker, код из 4 поста не работает на рабочем столе.<br />Подправишь?</p>]]></description>
			<author><![CDATA[null@example.com (Malcev)]]></author>
			<pubDate>Sat, 05 Sep 2015 04:40:54 +0000</pubDate>
			<guid>https://forum.script-coding.com/viewtopic.php?pid=97105#p97105</guid>
		</item>
		<item>
			<title><![CDATA[Re: AHK: Перенос выделенного файла в папку]]></title>
			<link>https://forum.script-coding.com/viewtopic.php?pid=96052#p96052</link>
			<description><![CDATA[<p>Вот библиотека специально для таких дел:<br /></p><div class="codebox"><pre><code>/*
    Library for getting info from a specific explorer window (if window handle not specified, the currently active
    window will be used).  Requires AHK_L or similar.  Works with the desktop.  Does not currently work with save
    dialogs and such.
    
    
    Explorer_GetSelected(hwnd=&quot;&quot;)   - paths of target window&#039;s selected items
    Explorer_GetAll(hwnd=&quot;&quot;)        - paths of all items in the target window&#039;s folder
    Explorer_GetPath(hwnd=&quot;&quot;)       - path of target window&#039;s folder
    
    example:
        F1::
            path := Explorer_GetPath()
            all := Explorer_GetAll()
            sel := Explorer_GetSelected()
            MsgBox % path
            MsgBox % all
            MsgBox % sel
        return
    
    Joshua A. Kinnison
    2011-04-27, 16:12
*/
Explorer_GetPath(hwnd=&quot;&quot;)
{
    if !(window := Explorer_GetWindow(hwnd))
        return ErrorLevel := &quot;ERROR&quot;
    if (window=&quot;desktop&quot;)
        return A_Desktop
    path := window.LocationURL
    path := RegExReplace(path, &quot;ftp://.*@&quot;,&quot;ftp://&quot;)
    StringReplace, path, path, file:///
    StringReplace, path, path, /, \, All 
    
    ; thanks to polyethene
    Loop
        If RegExMatch(path, &quot;i)(?&lt;=%)[\da-f]{1,2}&quot;, hex)
            StringReplace, path, path, `%%hex%, % Chr(&quot;0x&quot; . hex), All
        Else Break
    return path
}
Explorer_GetAll(hwnd=&quot;&quot;)
{
    return Explorer_Get(hwnd)
}
Explorer_GetSelected(hwnd=&quot;&quot;)
{
    return Explorer_Get(hwnd,true)
}

Explorer_GetWindow(hwnd=&quot;&quot;)
{
    ; thanks to jethrow for some pointers here
    WinGet, process, processName, % &quot;ahk_id&quot; hwnd := hwnd? hwnd:WinExist(&quot;A&quot;)
    WinGetClass class, ahk_id %hwnd%
    
    if (process!=&quot;explorer.exe&quot;)
        return
    if (class ~= &quot;(Cabinet|Explore)WClass&quot;)
    {
        for window in ComObjCreate(&quot;Shell.Application&quot;).Windows
            if (window.hwnd==hwnd)
                return window
    }
    else if (class ~= &quot;Progman|WorkerW&quot;) 
        return &quot;desktop&quot; ; desktop found
}
Explorer_Get(hwnd=&quot;&quot;,selection=false)
{
    if !(window := Explorer_GetWindow(hwnd))
        return ErrorLevel := &quot;ERROR&quot;
    if (window=&quot;desktop&quot;)
    {
        ControlGet, hwWindow, HWND,, SysListView321, ahk_class Progman
        if !hwWindow ; #D mode
            ControlGet, hwWindow, HWND,, SysListView321, A
        ControlGet, files, List, % ( selection ? &quot;Selected&quot;:&quot;&quot;) &quot;Col1&quot;,,ahk_id %hwWindow%
        base := SubStr(A_Desktop,0,1)==&quot;\&quot; ? SubStr(A_Desktop,1,-1) : A_Desktop
        Loop, Parse, files, `n, `r
        {
            path := base &quot;\&quot; A_LoopField
            IfExist %path% ; ignore special icons like Computer (at least for now)
                ret .= path &quot;`n&quot;
        }
    }
    else
    {
        if selection
            collection := window.document.SelectedItems
        else
            collection := window.document.Folder.Items
        for item in collection
            ret .= item.path &quot;`n&quot;
    }
    return Trim(ret,&quot;`n&quot;)
}</code></pre></div><p>Использование:<br /></p><div class="codebox"><pre><code>
#include lib.ahk
f11::
files:= Explorer_GetSelected()
if (Files != &quot;error&quot;)
    Loop, Parse, Files, `n, `r
        FileCopy, % A_loopField, % PathToYouFolder
return
</code></pre></div>]]></description>
			<author><![CDATA[null@example.com (Eduard)]]></author>
			<pubDate>Sun, 26 Jul 2015 10:03:38 +0000</pubDate>
			<guid>https://forum.script-coding.com/viewtopic.php?pid=96052#p96052</guid>
		</item>
		<item>
			<title><![CDATA[Re: AHK: Перенос выделенного файла в папку]]></title>
			<link>https://forum.script-coding.com/viewtopic.php?pid=96047#p96047</link>
			<description><![CDATA[<p>Спасибо всем!<br />Malcev тебе отдельное спасибо, скрипт работает и я могу его сам редактировать. Простота тут кстати! Поставил плюс в репутацию.</p>]]></description>
			<author><![CDATA[null@example.com (Umbra)]]></author>
			<pubDate>Sun, 26 Jul 2015 07:17:37 +0000</pubDate>
			<guid>https://forum.script-coding.com/viewtopic.php?pid=96047#p96047</guid>
		</item>
		<item>
			<title><![CDATA[Re: AHK: Перенос выделенного файла в папку]]></title>
			<link>https://forum.script-coding.com/viewtopic.php?pid=96035#p96035</link>
			<description><![CDATA[<p>Чем проще-то? У меня они все в одном месте, у тебя будут вразнобой. Впрочем, этот момент в данном случае не принципиален, как удобнее.</p>]]></description>
			<author><![CDATA[null@example.com (teadrinker)]]></author>
			<pubDate>Sat, 25 Jul 2015 21:14:52 +0000</pubDate>
			<guid>https://forum.script-coding.com/viewtopic.php?pid=96035#p96035</guid>
		</item>
		<item>
			<title><![CDATA[Re: AHK: Перенос выделенного файла в папку]]></title>
			<link>https://forum.script-coding.com/viewtopic.php?pid=96032#p96032</link>
			<description><![CDATA[<p>Зло - не зло, но в мой код добавить новый хотки проще, чем в твой.<br />Мой:<br /></p><div class="codebox"><pre><code>f11::
folder := &quot;c:\temp&quot;
GoTo, filemove
f12::
folder := &quot;c:\temp1&quot;
GoTo, filemove</code></pre></div><p>Твой:<br /></p><div class="codebox"><pre><code>KeysAndFolders := {F10: A_Desktop &quot;\MyFirstFolder&quot;, F11: A_Desktop &quot;\MySecondFolder&quot;}
F10::
F11::</code></pre></div><p>А буфер обмена дает нам больше маневров - твой вариант будет работать только в эксплорере.</p>]]></description>
			<author><![CDATA[null@example.com (Malcev)]]></author>
			<pubDate>Sat, 25 Jul 2015 20:45:27 +0000</pubDate>
			<guid>https://forum.script-coding.com/viewtopic.php?pid=96032#p96032</guid>
		</item>
		<item>
			<title><![CDATA[Re: AHK: Перенос выделенного файла в папку]]></title>
			<link>https://forum.script-coding.com/viewtopic.php?pid=96031#p96031</link>
			<description><![CDATA[<p>Чем предпочтительней? GoTo — зло, Clipboard предназначен для пользователя, а не для приложений.</p>]]></description>
			<author><![CDATA[null@example.com (teadrinker)]]></author>
			<pubDate>Sat, 25 Jul 2015 20:33:23 +0000</pubDate>
			<guid>https://forum.script-coding.com/viewtopic.php?pid=96031#p96031</guid>
		</item>
		<item>
			<title><![CDATA[Re: AHK: Перенос выделенного файла в папку]]></title>
			<link>https://forum.script-coding.com/viewtopic.php?pid=96030#p96030</link>
			<description><![CDATA[<p>Ну вот тут разве GoTo не предпочтительней?<br />Добавлять проще.<br /></p><div class="codebox"><pre><code>f11::
folder := &quot;c:\temp&quot;
GoTo, filemove
f12::
folder := &quot;c:\temp1&quot;
GoTo, filemove

filemove:
clipboard := &quot;&quot;
Send, ^{vk43}   ; Ctrl + C
ClipWait, 2
if ErrorLevel
{
   MsgBox, Буфер обмена пуст!
   Return
}
Loop, parse, clipboard, `n, `r
   FileMove,%A_LoopField%, %folder%
Return</code></pre></div>]]></description>
			<author><![CDATA[null@example.com (Malcev)]]></author>
			<pubDate>Sat, 25 Jul 2015 20:23:23 +0000</pubDate>
			<guid>https://forum.script-coding.com/viewtopic.php?pid=96030#p96030</guid>
		</item>
		<item>
			<title><![CDATA[Re: AHK: Перенос выделенного файла в папку]]></title>
			<link>https://forum.script-coding.com/viewtopic.php?pid=96029#p96029</link>
			<description><![CDATA[<p>По F10 помещает выделенные файлы в активном окне в Рабочий стол\MyFirstFolder, по F11 в Рабочий стол\MySecondFolder:<br /></p><div class="codebox"><pre><code>KeysAndFolders := {F10: A_Desktop &quot;\MyFirstFolder&quot;, F11: A_Desktop &quot;\MySecondFolder&quot;}
F10::
F11::
   if !Paths := GetSelected()  {
      MsgBox, Выделенные файлы не найдены!
      Return
   }
   if !FileExist(dir := KeysAndFolders[A_ThisHotkey])
      FileCreateDir, % dir
   
   Loop, parse, Paths, `n
      FileMove, % A_LoopField, % dir
   Return

GetSelected(hwnd=&quot;&quot;)
{
   if (hwnd = &quot;&quot;)
      WinGet, hwnd,, A
   
   for window in ComObjCreate(&quot;Shell.Application&quot;).Windows
      if (window.hwnd = hwnd &amp;&amp; found := 1)
         break

   if !found
      return

   for item in window.document.SelectedItems
      paths .= item.path &quot;`n&quot;
   
   Return Trim(paths, &quot;`n&quot;)
}</code></pre></div>]]></description>
			<author><![CDATA[null@example.com (teadrinker)]]></author>
			<pubDate>Sat, 25 Jul 2015 20:09:17 +0000</pubDate>
			<guid>https://forum.script-coding.com/viewtopic.php?pid=96029#p96029</guid>
		</item>
		<item>
			<title><![CDATA[Re: AHK: Перенос выделенного файла в папку]]></title>
			<link>https://forum.script-coding.com/viewtopic.php?pid=96028#p96028</link>
			<description><![CDATA[<div class="quotebox"><blockquote><p>Поищите по форуму &quot;значок под курсором&quot;, что-то вроде этого.</p></blockquote></div><p>Зачем, Ведь нужно вроде:<br /></p><div class="quotebox"><blockquote><p>выделенный мышкой файл по нажатию определенного бинда</p></blockquote></div><p>Я б не мудрствовал и пускал через буфер обмена:<br /></p><div class="codebox"><pre><code>folder := &quot;c:\temp&quot;

f11::
clipboard := &quot;&quot;
Send, ^{vk43}   ; Ctrl + C
ClipWait, 2
if ErrorLevel
{
   MsgBox, Буфер обмена пуст!
   Return
}
Loop, parse, clipboard, `n, `r
   FileMove,%A_LoopField%, %folder%
Return</code></pre></div>]]></description>
			<author><![CDATA[null@example.com (Malcev)]]></author>
			<pubDate>Sat, 25 Jul 2015 19:56:18 +0000</pubDate>
			<guid>https://forum.script-coding.com/viewtopic.php?pid=96028#p96028</guid>
		</item>
		<item>
			<title><![CDATA[Re: AHK: Перенос выделенного файла в папку]]></title>
			<link>https://forum.script-coding.com/viewtopic.php?pid=96027#p96027</link>
			<description><![CDATA[<p>Поищите по форуму &quot;значок под курсором&quot;, что-то вроде этого. Скрипт получает путь к файлу и перемещает его в нужную папку.</p>]]></description>
			<author><![CDATA[null@example.com (ypppu)]]></author>
			<pubDate>Sat, 25 Jul 2015 19:22:18 +0000</pubDate>
			<guid>https://forum.script-coding.com/viewtopic.php?pid=96027#p96027</guid>
		</item>
	</channel>
</rss>
