<?xml version="1.0" encoding="utf-8"?>
<rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom">
	<channel>
		<title><![CDATA[Серый форум &mdash; autohotkey: copy from ListBox]]></title>
		<link>https://forum.script-coding.com/viewtopic.php?id=13849</link>
		<atom:link href="https://forum.script-coding.com/extern.php?action=feed&amp;tid=13849&amp;type=rss" rel="self" type="application/rss+xml" />
		<description><![CDATA[Недавние сообщения в теме «autohotkey: copy from ListBox».]]></description>
		<lastBuildDate>Thu, 14 Jun 2018 23:14:36 +0000</lastBuildDate>
		<generator>PunBB</generator>
		<item>
			<title><![CDATA[Re: autohotkey: copy from ListBox]]></title>
			<link>https://forum.script-coding.com/viewtopic.php?pid=126036#p126036</link>
			<description><![CDATA[<p>Hi<br />You don&#039;t need to use <em>Loop, parse</em> for copying the row from the ListBox, use <em>GuiControlGet</em> like this:<br /></p><div class="codebox"><pre><code>Loop, Files, %A_Desktop%\*.*, DF
   files .= (A_Index = 1 ? &quot;&quot; : &quot;|&quot;) . A_LoopFileName

Gui, Add, ListBox, w300 h200 vList1, % files
Gui, Add, Button, gCopy, Copy Selected
Gui, Show
Return

Copy:
   GuiControlGet, List1
   MsgBox, % List1
   Return</code></pre></div>]]></description>
			<author><![CDATA[null@example.com (teadrinker)]]></author>
			<pubDate>Thu, 14 Jun 2018 23:14:36 +0000</pubDate>
			<guid>https://forum.script-coding.com/viewtopic.php?pid=126036#p126036</guid>
		</item>
		<item>
			<title><![CDATA[autohotkey: copy from ListBox]]></title>
			<link>https://forum.script-coding.com/viewtopic.php?pid=126034#p126034</link>
			<description><![CDATA[<p>Hi everyone<br />I am a new user and ask for help<br />the following code for A folder comparison, it&#039;s from here: <br /><a href="https://autohotkey.com/boards/viewtopic.php?f=5&amp;t=48230&amp;p=215966#p215966">https://autohotkey.com/boards/viewtopic … 66#p215966</a></p><div class="codebox"><pre><code>
#NoEnv 
#SingleInstance force 
#Persistent   

nameBUT := StrSplit(&quot;SALES|Cashing|Button3|Button4|Button5|Button6|DocFiles|PdfFiles&quot;, &quot;|&quot;)   

Gui Add, ListBox, w650 r10 vfiles1, % &quot;Dir1 = &quot; dir1 &quot;| |&quot; list1
Gui Add, ListBox, xm w650 r10 vfiles2, % &quot;Dir2 = &quot; dir2 &quot;| |&quot; list2
Gui Add, Button, w75 gGuiOK default, Exit
Gui,Add, Text, yp+5 x100,Dir1
Gui,Add, Edit, yp-3 x130 w200 vDir1,%dir1%
Gui,Add, Text, yp+2 x340,Dir2
Gui,Add, Edit, yp-3 x365 w200 vDir2,%dir2%
Gui,Add, Text, yp+2 x575,Mask
Gui,Add, Edit, yp-3 x605 w75 vFileMask,%fileMask%
Gui Add, Button, yp x685 w75 gGo, Go
Gosub, AddRightSideButtons
Gui Show, w775
Return

AddRightSideButtons:
    GuiControlGet, ctl, Pos, files1

    x := ctlX + ctlW + 10
    Gui, Add, Button, x%x% y%ctlY% w90 h28 gBUT, % nameBUT[1]  
    Loop, 7
        Gui, Add, Button, wp hp gBUT, % nameBUT[A_index+1]  
return

Go: 
    Gui, Submit, NoHide 
    gosub, DoTheWork
    GuiControl,,files1,% &quot;|Dir1 = &quot; dir1 &quot;| |&quot; list1
    GuiControl,,files2,% &quot;|Dir2 = &quot; dir2 &quot;| |&quot; list2
return

BUT:
If (A_GuiControl=nameBUT[1]){
    ControlSetText, Edit1, % &quot;E:\ask\work&quot;
    ControlSetText, Edit2, % &quot;E:\ask\backup&quot;
    }
Else
  If (A_GuiControl=nameBUT[2]){
      ControlSetText, Edit1,% &quot;E:\ask\sales&quot;
      ControlSetText, Edit2, % &quot;E:\ask\work&quot;
  }
Else
  If (A_GuiControl=nameBUT[7]){
      ControlSetText, Edit3, *.docx
      ControlClick, Go, Comp 
  }
Else
  If (A_GuiControl=nameBUT[8]){
      ControlSetText, Edit3, *.pdf
      ControlClick, Go, Go 
  }  
Else
    Msgbox % &quot;NONE!!&quot; A_GuiControl

return

GuiOK:
GuiClose:
GuiEscape:
ExitApp



DoTheWork:
filelist1 := filelist2 := &quot;&quot;
list1 := list2 := &quot;&quot;
fnb1 := fnb2 := 0 ; &lt;&lt;&lt;&lt;&lt; added: initialize the counters
Loop %dir1%\%fileMask%
{
If ( A_LoopFileName ~= &quot;~\$&quot;)
        continue
    fileList1 .= A_LoopFileName . &quot;`n&quot;
    fnb1++ ; &lt;&lt;&lt;&lt;&lt; changed: don&#039;t use A_Index because some files may be skipped
}
StringTrimRight fileList1, fileList1, 1
Loop %dir2%\%fileMask%
{
    If ( A_LoopFileName ~= &quot;~\$&quot;)
        continue
    fileList2 .= A_LoopFileName . &quot;`n&quot;
    fnb2++ ; &lt;&lt;&lt;&lt;&lt; changed: don&#039;t use A_Index because some files may be skipped
}
StringTrimRight fileList2, fileList2, 1

If (fnb1 = 0) &amp;&amp; (fnb2 = 0) ; &lt;&lt;&lt;&lt;&lt; added: early return
    Return

Sort fileList1
Sort fileList2
StringSplit files_1_, fileList1, `n
StringSplit files_2_, fileList2, `n
idxF1 := idxF2 := 1

Loop
{
    If (idxF1 &gt; fnb1) ; &lt;&lt;&lt;&lt;&lt; moved to the top of the loop
    {
        Loop % fnb2 - idxF2 + 1
        {
            list1 .= &quot; |&quot;   ; Empty
            list2 .= files_2_%idxF2% . &quot;|&quot;
            idxF2++
        }
        Break
    }
    If (idxF2 &gt; fnb2) ; &lt;&lt;&lt;&lt;&lt; moved to the top of the loop
    {
        Loop % fnb1 - idxF1 + 1
        {
            list1 .= files_1_%idxF1% . &quot;|&quot;
            idxF1++
            list2 .= &quot; |&quot;   ; Empty
        }
        Break
    }
    If (files_1_%idxF1% = files_2_%idxF2%)
    {
        ; We are in synch
        list1 .= files_1_%idxF1% . &quot;|&quot;
        idxF1++
        list2 .= files_2_%idxF2% . &quot;|&quot;
        idxF2++
    }
    Else
    {
        ; Either file at idxF1 or at idxF3 is missing, we must find which one
        If (files_1_%idxF1% &gt; files_2_%idxF2%)
        {
            ; Missing in first list
            list1 .= &quot; |&quot;   ; Empty
            list2 .= files_2_%idxF2% . &quot;|&quot;
            idxF2++
        }
        Else
        {
            ; Missing in second list
            list1 .= files_1_%idxF1% . &quot;|&quot;
            idxF1++
            list2 .= &quot; |&quot;   ; Empty
        }
    }
}

StringTrimRight list1, list1, 1
StringTrimRight list2, list2, 1
Return
</code></pre></div><p>my question is:</p><p>How to use:<br /></p><div class="codebox"><pre><code>
Loop, parse, List1
Loop, parse, List2
</code></pre></div><p>to Makes copy of the selected file In the ListBox1 or the ListBox2. (See the picture)<br />If someone could show me how to do this, I would be very grateful!<br />thanks in advance</p>]]></description>
			<author><![CDATA[null@example.com (asad)]]></author>
			<pubDate>Thu, 14 Jun 2018 22:31:44 +0000</pubDate>
			<guid>https://forum.script-coding.com/viewtopic.php?pid=126034#p126034</guid>
		</item>
	</channel>
</rss>
