<?xml version="1.0" encoding="utf-8"?>
<rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom">
	<channel>
		<title><![CDATA[Серый форум &mdash; AHK (HelpToAHK_L): ShellFileOperation]]></title>
		<link>https://forum.script-coding.com/viewtopic.php?id=8155</link>
		<atom:link href="https://forum.script-coding.com/extern.php?action=feed&amp;tid=8155&amp;type=rss" rel="self" type="application/rss+xml" />
		<description><![CDATA[Недавние сообщения в теме «AHK (HelpToAHK_L): ShellFileOperation».]]></description>
		<lastBuildDate>Mon, 18 Mar 2013 13:02:22 +0000</lastBuildDate>
		<generator>PunBB</generator>
		<item>
			<title><![CDATA[Re: AHK (HelpToAHK_L): ShellFileOperation]]></title>
			<link>https://forum.script-coding.com/viewtopic.php?pid=70428#p70428</link>
			<description><![CDATA[<p>Эврика:</p><div class="codebox"><pre><code>ShellFileOperation( fileO=0x0, fSource=&quot;&quot;, fTarget=&quot;&quot;, flags=0x0, ghwnd=0x0 )     
{
    
    If ( SubStr(fSource,0) != &quot;|&quot; )
        fSource := fSource . &quot;|&quot;

    If ( SubStr(fTarget,0) != &quot;|&quot; )
        fTarget := fTarget . &quot;|&quot;
    
    char_size := A_IsUnicode ? 2 : 1
    char_type := A_IsUnicode ? &quot;UShort&quot; : &quot;Char&quot;
    
    fsPtr := &amp;fSource
    Loop % StrLen(fSource)
        if NumGet(fSource, (A_Index-1)*char_size, char_type) = 124
            NumPut(0, fSource, (A_Index-1)*char_size, char_type)

    ftPtr := &amp;fTarget
    Loop % StrLen(fTarget)
        if NumGet(fTarget, (A_Index-1)*char_size, char_type) = 124
            NumPut(0, fTarget, (A_Index-1)*char_size, char_type)
    
    VarSetCapacity( SHFILEOPSTRUCT, 60, 0 )                 ; Encoding SHFILEOPSTRUCT
    NextOffset := NumPut( ghwnd, &amp;SHFILEOPSTRUCT )          ; hWnd of calling GUI
    NextOffset := NumPut( fileO, NextOffset+0    )          ; File operation
    NextOffset := NumPut( fsPtr, NextOffset+0    )          ; Source file / pattern
    NextOffset := NumPut( ftPtr, NextOffset+0    )          ; Target file / folder
    NextOffset := NumPut( flags, NextOffset+0, 0, &quot;Short&quot; ) ; options

    DllCall( &quot;Shell32\SHFileOperation&quot; . (A_IsUnicode ? &quot;W&quot; : &quot;A&quot;), UInt,&amp;SHFILEOPSTRUCT )
    
    Return NumGet( NextOffset+0 )
}</code></pre></div>]]></description>
			<author><![CDATA[null@example.com (DD)]]></author>
			<pubDate>Mon, 18 Mar 2013 13:02:22 +0000</pubDate>
			<guid>https://forum.script-coding.com/viewtopic.php?pid=70428#p70428</guid>
		</item>
		<item>
			<title><![CDATA[Re: AHK (HelpToAHK_L): ShellFileOperation]]></title>
			<link>https://forum.script-coding.com/viewtopic.php?pid=70425#p70425</link>
			<description><![CDATA[<p><strong>creature.ws</strong>, спасибо. Но хотелось бы приноровить первоначальный код к AHK_L, потому что при копировании там можно задействовать целый ряд возможностей (переменная &quot;flags&quot;). Кроме того на нём основывается скрипт, который пытаюсь &quot;оживить&quot;.</p>]]></description>
			<author><![CDATA[null@example.com (DD)]]></author>
			<pubDate>Mon, 18 Mar 2013 10:29:04 +0000</pubDate>
			<guid>https://forum.script-coding.com/viewtopic.php?pid=70425#p70425</guid>
		</item>
		<item>
			<title><![CDATA[Re: AHK (HelpToAHK_L): ShellFileOperation]]></title>
			<link>https://forum.script-coding.com/viewtopic.php?pid=70424#p70424</link>
			<description><![CDATA[<div class="codebox"><pre><code>^vk51::
    Clipboard := &quot;&quot;
    SendInput, {Ctrl Down}{vk43}{Ctrl Up}
    ClipWait

    loop parse, Clipboard, `n, `r
    {
        Splitpath A_LoopField, name
        dest := A_Desktop &quot;\&quot; name

        if InStr(FileExist(A_LoopField), &quot;D&quot;)
            FileCopyDir % A_LoopField, % dest
        else FileCopy % A_LoopField, % dest
    }
Return</code></pre></div><p>Использование DllCall делает решение любой задачи внушительнее.</p>]]></description>
			<author><![CDATA[null@example.com (creature.ws)]]></author>
			<pubDate>Mon, 18 Mar 2013 10:03:34 +0000</pubDate>
			<guid>https://forum.script-coding.com/viewtopic.php?pid=70424#p70424</guid>
		</item>
		<item>
			<title><![CDATA[Re: AHK (HelpToAHK_L): ShellFileOperation]]></title>
			<link>https://forum.script-coding.com/viewtopic.php?pid=70422#p70422</link>
			<description><![CDATA[<p>Как раз забыл добавить вопрос: как оный DllCall() заставить копировать, на AHK_L он не работает.<br />По поводу посыла Ctrl+C согласен, использовал как пример, для удобства и краткости.</p>]]></description>
			<author><![CDATA[null@example.com (DD)]]></author>
			<pubDate>Mon, 18 Mar 2013 08:49:11 +0000</pubDate>
			<guid>https://forum.script-coding.com/viewtopic.php?pid=70422#p70422</guid>
		</item>
		<item>
			<title><![CDATA[Re: AHK (HelpToAHK_L): ShellFileOperation]]></title>
			<link>https://forum.script-coding.com/viewtopic.php?pid=70416#p70416</link>
			<description><![CDATA[<div class="quotebox"><cite>DD пишет:</cite><blockquote><p>По Ctrl+Q должен копировать выбранный файл на Рабочий.</p></blockquote></div><p>Должен, но не копирует. <img src="//forum.script-coding.com/img/smilies/smile.png" width="15" height="15" /> Windows 7.</p><p>Потом, если уж используешь для копирования &quot;продвинутый&quot; DllCall(), то моветон получать выделенные файлы примитивным посылом Ctrl+C.</p>]]></description>
			<author><![CDATA[null@example.com (teadrinker)]]></author>
			<pubDate>Sun, 17 Mar 2013 22:33:38 +0000</pubDate>
			<guid>https://forum.script-coding.com/viewtopic.php?pid=70416#p70416</guid>
		</item>
		<item>
			<title><![CDATA[AHK (HelpToAHK_L): ShellFileOperation]]></title>
			<link>https://forum.script-coding.com/viewtopic.php?pid=70412#p70412</link>
			<description><![CDATA[<p>По Ctrl+Q должен копировать выбранный файл на Рабочий.</p><div class="codebox"><pre><code>
#SingleInstance force

TargetDir = %A_Desktop%\

^vk51::                                      ;Ctrl+Q
   clipboard =
   SendInput, {Ctrl Down}{vk43}{Ctrl Up}     ;Ctrl+C
   ClipWait

   GlobalFileList = %clipboard%

   flags := ( FOF_NOCONFIRMMKDIR := 0x200 ) | (FOF_NOCONFIRMATION := 0x10)
   Loop, parse, GlobalFileList, `r`n
   {
      if (A_LoopField &lt;&gt; &quot;&quot;)
      {
         ;MsgBox, Source %A_LoopField%, Target is %TargetDir%
         ShellFileOperation(0x2, A_LoopField, TargetDir, flags)
      }
   }
Return

ShellFileOperation( fileO=0x0, fSource=&quot;&quot;, fTarget=&quot;&quot;, flags=0x0, ghwnd=0x0 )     
{
 If ( SubStr(fSource,0) != &quot;|&quot; )
      fSource := fSource . &quot;|&quot;

 If ( SubStr(fTarget,0) != &quot;|&quot; )
      fTarget := fTarget . &quot;|&quot;

 fsPtr := &amp;fSource
 Loop, % StrLen(fSource)
  If ( *(fsPtr+(A_Index-1)) = 124 ) 
      DllCall( &quot;RtlFillMemory&quot;, UInt, fsPtr+(A_Index-1), Int,1, UChar,0 ) 

 ftPtr := &amp;fTarget
 Loop, % StrLen(fTarget)
  If ( *(ftPtr+(A_Index-1)) = 124 ) 
      DllCall( &quot;RtlFillMemory&quot;, UInt, ftPtr+(A_Index-1), Int,1, UChar,0 ) 

 VarSetCapacity( SHFILEOPSTRUCT, 30, 0 )                 ; Encoding SHFILEOPSTRUCT
 NextOffset := NumPut( ghwnd, &amp;SHFILEOPSTRUCT )          ; hWnd of calling GUI
 NextOffset := NumPut( fileO, NextOffset+0    )          ; File operation
 NextOffset := NumPut( fsPtr, NextOffset+0    )          ; Source file / pattern
 NextOffset := NumPut( ftPtr, NextOffset+0    )          ; Target file / folder
 NextOffset := NumPut( flags, NextOffset+0, 0, &quot;Short&quot; ) ; options

 DllCall( &quot;Shell32\SHFileOperationA&quot;, UInt,&amp;SHFILEOPSTRUCT )
 
Return NumGet( NextOffset+0 )
}
</code></pre></div>]]></description>
			<author><![CDATA[null@example.com (DD)]]></author>
			<pubDate>Sun, 17 Mar 2013 20:41:46 +0000</pubDate>
			<guid>https://forum.script-coding.com/viewtopic.php?pid=70412#p70412</guid>
		</item>
	</channel>
</rss>
