<?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=14686&amp;type=atom" />
	<updated>2019-04-09T17:51:15Z</updated>
	<generator>PunBB</generator>
	<id>https://forum.script-coding.com/viewtopic.php?id=14686</id>
		<entry>
			<title type="html"><![CDATA[Re: AHK: Добавление в цикл нового параметра]]></title>
			<link rel="alternate" href="https://forum.script-coding.com/viewtopic.php?pid=133458#p133458" />
			<content type="html"><![CDATA[<div class="codebox"><pre><code>If !(num &amp; 1)  ;	num чётное</code></pre></div>]]></content>
			<author>
				<name><![CDATA[serzh82saratov]]></name>
				<uri>https://forum.script-coding.com/profile.php?id=27879</uri>
			</author>
			<updated>2019-04-09T17:51:15Z</updated>
			<id>https://forum.script-coding.com/viewtopic.php?pid=133458#p133458</id>
		</entry>
		<entry>
			<title type="html"><![CDATA[Re: AHK: Добавление в цикл нового параметра]]></title>
			<link rel="alternate" href="https://forum.script-coding.com/viewtopic.php?pid=133457#p133457" />
			<content type="html"><![CDATA[<p>Еще один вопрос возник, нигде не нашел, возможно плохо искал. Дабы не создавать новую тему, спрошу тут. Как проверить число на четное и нечетное. То, есть, допустим: <br /></p><div class="codebox"><pre><code>Если чесло четное, 
{
	То: Действие
}
Во всех остальных случиях:
{
	Действие
}
</code></pre></div>]]></content>
			<author>
				<name><![CDATA[qwerlog]]></name>
				<uri>https://forum.script-coding.com/profile.php?id=31302</uri>
			</author>
			<updated>2019-04-09T17:07:33Z</updated>
			<id>https://forum.script-coding.com/viewtopic.php?pid=133457#p133457</id>
		</entry>
		<entry>
			<title type="html"><![CDATA[Re: AHK: Добавление в цикл нового параметра]]></title>
			<link rel="alternate" href="https://forum.script-coding.com/viewtopic.php?pid=133357#p133357" />
			<content type="html"><![CDATA[<p>Для отладки построения можете сделать так:<br /></p><div class="codebox"><pre><code>
For k, v in pos 
	; Gui, Add, Progress, % &quot;Hidden0 Border x&quot; v[1] &quot; y&quot; v[2] &quot; w&quot; s &quot; h&quot; s &quot; cFFE891&quot;, 100 
	Gui, Add, Text, % &quot;Border +0x201 Hidden0 x&quot; v[1] &quot; y&quot; v[2] &quot; w&quot; s &quot; h&quot; s, %k%</code></pre></div><p>Будет видно в каком порядке создаются позиции.<br />Первый элемент в rank, это абсолютные координаты отправной точки, другие, относительные предыдущей позиции.<br />Вот ещё пример.<br /></p><div class="codebox"><pre><code>rank := [[st, st]]
step := 0.6
lenght := 12
loop % lenght  
	rank.Push([step,step])
loop % lenght
	rank.Push([0,-step])
loop % lenght
	rank.Push([-step,step])
loop % lenght - 1
	rank.Push([0,-step])</code></pre></div><div class="fancy_spoiler_switcher"><div class="fancy_spoiler_switcher_header" data-lang-open="открыть спойлер" data-lang-close="скрыть спойлер"><strong>+</strong>&nbsp;открыть спойлер</div><div class="fancy_spoiler"><p><span class="postimg"><img src="https://i.imgur.com/C0d2TLI.png" alt="https://i.imgur.com/C0d2TLI.png" /></span></p></div></div>]]></content>
			<author>
				<name><![CDATA[serzh82saratov]]></name>
				<uri>https://forum.script-coding.com/profile.php?id=27879</uri>
			</author>
			<updated>2019-04-05T13:10:46Z</updated>
			<id>https://forum.script-coding.com/viewtopic.php?pid=133357#p133357</id>
		</entry>
		<entry>
			<title type="html"><![CDATA[Re: AHK: Добавление в цикл нового параметра]]></title>
			<link rel="alternate" href="https://forum.script-coding.com/viewtopic.php?pid=133348#p133348" />
			<content type="html"><![CDATA[<p><strong>serzh82saratov</strong> Спасибо, сложноватый код для меня, особенно после года дерградации в армии. Но буду изучать</p>]]></content>
			<author>
				<name><![CDATA[qwerlog]]></name>
				<uri>https://forum.script-coding.com/profile.php?id=31302</uri>
			</author>
			<updated>2019-04-04T14:43:02Z</updated>
			<id>https://forum.script-coding.com/viewtopic.php?pid=133348#p133348</id>
		</entry>
		<entry>
			<title type="html"><![CDATA[Re: AHK: Добавление в цикл нового параметра]]></title>
			<link rel="alternate" href="https://forum.script-coding.com/viewtopic.php?pid=133347#p133347" />
			<content type="html"><![CDATA[<div class="codebox"><pre><code>
#SingleInstance Force 
#NoEnv
SetBatchLines -1
ListLines Off
DetectHiddenWindows, On

s := 40
st := 10	
	
rank := [[s + st + st, (s + st) * 2 + st], [-0.5,-1], [-0.5,-1] 
	, [1,0], [1,0], [1,0], [1,0]
	, [-0.5,1], [-0.5,1], [-0.5,1], [-0.5,1]
	, [-0.5,1], [-0.5,1], [-0.5,1], [-0.5,1] 
	, [1,0], [1,0], [1,0], [1,0]
	, [-0.5,-1], [-0.5,-1]]

pos := CreatePos(rank, s, st)
Count := 0 
Pics := []
Items := []

loop % pos.Count() - 1
	Pics.Push(LoadPicture(&quot;Shell32.dll&quot;, &quot;Icon&quot; 200 + A_Index))

Gui, -DPIScale +AlwaysOnTop +HWNDhGui
Gui, Color, 536FBE
Gui, Margin, %st%, %st%   
For k, v in pos 
	Gui, Add, Progress, % &quot;Hidden0 Border x&quot; v[1] &quot; y&quot; v[2] &quot; w&quot; s &quot; h&quot; s &quot; cFFE891&quot;, 100 
Gui, Font, s16
Gui Show, Hide
WinGetPos, , , , H, ahk_id %hGui%
Gui Add, Button, y%H% x40 gAdd vAdd Default, Add
Gui Add, Button, yp x+40 wp gSub vSub Default, Sub
Gui Show, AutoSize

loop
	loop % pos.Count()
	{ 
		i := A_Index
		loop % Count
		{
			ic := i - A_Index + 1
			ic := ic &lt; 1 ? pos.Count() + ic : ic
			GuiControl, Move, % Items[A_Index], % &quot;x&quot; pos[ic][1] &quot; y&quot; pos[ic][2] 
		} 
		Sleep 100
	}
Return  

Sub:
	If (Count &lt; 1)
		Return
	DllCall(&quot;DestroyWindow&quot;, &quot;Ptr&quot;, Items.Pop()), --Count 
	Return
	
Add:
	If (Count = Pics.Count())
		Return 
	Gui, Add, Pic, HWNDhItem x-32000 y-32000 w%s% h%s% +BackgroundTrans, % &quot;HBITMAP:*&quot; Pics[++Count]
	Items[Count] := hItem
    Return

CreatePos(rank, s, st) {
	arr := []
	For k, v in rank
	{
		If (k = 1)
			arr[k] := [v[1], v[2]]
		Else
			arr[k] := [arr[k - 1][1] + (v[1] * (s + st))
			, arr[k - 1][2] + (v[2] * (s + st))] 
	}
	Return arr
}
	
GuiEscape:
GuiClose:
	ExitApp  
 </code></pre></div>]]></content>
			<author>
				<name><![CDATA[serzh82saratov]]></name>
				<uri>https://forum.script-coding.com/profile.php?id=27879</uri>
			</author>
			<updated>2019-04-04T14:12:10Z</updated>
			<id>https://forum.script-coding.com/viewtopic.php?pid=133347#p133347</id>
		</entry>
		<entry>
			<title type="html"><![CDATA[Re: AHK: Добавление в цикл нового параметра]]></title>
			<link rel="alternate" href="https://forum.script-coding.com/viewtopic.php?pid=133339#p133339" />
			<content type="html"><![CDATA[<p>Это, к примеру, может быть и так:<br /><a href="https://i.imgur.com/QAQFyLs.png">https://i.imgur.com/QAQFyLs.png</a></p>]]></content>
			<author>
				<name><![CDATA[qwerlog]]></name>
				<uri>https://forum.script-coding.com/profile.php?id=31302</uri>
			</author>
			<updated>2019-04-03T23:15:11Z</updated>
			<id>https://forum.script-coding.com/viewtopic.php?pid=133339#p133339</id>
		</entry>
		<entry>
			<title type="html"><![CDATA[Re: AHK: Добавление в цикл нового параметра]]></title>
			<link rel="alternate" href="https://forum.script-coding.com/viewtopic.php?pid=133338#p133338" />
			<content type="html"><![CDATA[<p><strong>serzh82saratov</strong> Это то, что нужно, но проблема в том, что &quot;progress&quot; не очень подходит в этом плане. Изображения не всегда будут передвигаться по прямой, иногда вверх, вниз. Почему изображения? просто как раз таки для меня в этом коде они будут играть некую роль. Что и куда двиграться? Чтобы по понятнее выразиться, из пункта А пункт Б.</p>]]></content>
			<author>
				<name><![CDATA[qwerlog]]></name>
				<uri>https://forum.script-coding.com/profile.php?id=31302</uri>
			</author>
			<updated>2019-04-03T23:07:52Z</updated>
			<id>https://forum.script-coding.com/viewtopic.php?pid=133338#p133338</id>
		</entry>
		<entry>
			<title type="html"><![CDATA[Re: AHK: Добавление в цикл нового параметра]]></title>
			<link rel="alternate" href="https://forum.script-coding.com/viewtopic.php?pid=133337#p133337" />
			<content type="html"><![CDATA[<p>Я всё таки не пойму, что у вас куда должно двигаться, и зачем обязательно нужны картинки для тестирования.<br /></p><div class="codebox"><pre><code>
#SingleInstance Force 
#NoEnv
SetBatchLines -1
ListLines Off

s := 40
st := 10
Lenght := 20
Count := 0

xob := (((Lenght * s) + (st * (Lenght + 1))) - 200) / 2

Gui, -DPIScale +AlwaysOnTop  
Gui, Color, FFFFFF
Gui, Margin, %st%, %st%  
Gui, Add, Text, x0 w0 Hidden
loop % Lenght
	Gui, Add, Progress, % &quot;Border x+&quot; st &quot; yp w&quot; s &quot; h&quot; s &quot; cFFE891&quot;, 100 
Gui, Font, s22
Gui Add, Button, y+20 x%xob% w200 gAdd vAdd Default, Добавить
Gui Show 

loop 
	loop % Lenght
	{ 
		i := A_Index
		loop % Count 
		{ 
			ic := i - A_Index + 1
			ic := ic &lt; 1 ? Lenght + ic : ic
			x := st + (ic - 1) * (s + st) 
			GuiControl, MoveDraw, Smile%A_Index%, % &quot;x&quot; x &quot; y&quot; st  
		} 
		Sleep 100
	}
Return  

Add:  
	++Count  
	Gui, Add, Text, vSmile%Count% +0x201 Border x-32000 y-32000 w%s% h%s% +BackgroundTrans, %Count% 
	If (Count = Lenght - 1)
		GuiControl, Disable, Add 
    Return
	
GuiEscape:
GuiClose:
	ExitApp  
</code></pre></div><div class="fancy_spoiler_switcher"><div class="fancy_spoiler_switcher_header" data-lang-open="открыть спойлер" data-lang-close="скрыть спойлер"><strong>+</strong>&nbsp;открыть спойлер</div><div class="fancy_spoiler"><div class="codebox"><pre><code>#SingleInstance Force 
#NoEnv
SetBatchLines -1
ListLines Off

s := 40
st := 10
Lenght := 20
Count := 0

xob := (((Lenght * s) + (st * (Lenght + 1))) - 200) / 2

Gui, -DPIScale +AlwaysOnTop  
Gui, Color, FFFFFF
Gui, Margin, %st%, %st%  
Gui, Add, Text, x0 w0 Hidden
loop % Lenght
	Gui, Add, Progress, % &quot;Border x+&quot; st &quot; yp w&quot; s &quot; h&quot; s &quot; cFFE891&quot;, 100 
Gui, Font, s22
Gui Add, Button, y+20 x%xob% w200 gAdd vAdd Default, Добавить
Gui Show 

loop 
	loop % Lenght
	{ 
		i := A_Index
		loop % Count 
		{ 
			ic := i - A_Index + 1
			ic := ic &lt; 1 ? Lenght + ic : ic
			x := st + (ic - 1) * (s + st) 
			GuiControl, Move, Smile%A_Index%, % &quot;x&quot; x &quot; y&quot; st  
		} 
		Sleep 100
	}
Return  

Add:  
	++Count 
	Gui, Add, Progress, vSmile%Count% x-32000 y-32000 w%s% h%s% c29B400, 100   
	If (Count = Lenght - 1)
		GuiControl, Disable, Add 
    Return
	
GuiEscape:
GuiClose:
	ExitApp  </code></pre></div></div></div>]]></content>
			<author>
				<name><![CDATA[serzh82saratov]]></name>
				<uri>https://forum.script-coding.com/profile.php?id=27879</uri>
			</author>
			<updated>2019-04-03T22:45:11Z</updated>
			<id>https://forum.script-coding.com/viewtopic.php?pid=133337#p133337</id>
		</entry>
		<entry>
			<title type="html"><![CDATA[Re: AHK: Добавление в цикл нового параметра]]></title>
			<link rel="alternate" href="https://forum.script-coding.com/viewtopic.php?pid=133336#p133336" />
			<content type="html"><![CDATA[<p>Додумался как добавить 1 параметр, но на неограниченное количество пока не<br /></p><div class="codebox"><pre><code>Gui, Add, Picture, x2 y-1 w510 h60 , load.png
Gui, Add, Button, x222 y69 w100 h30 gAdd, Добавить
Gui, Add, Picture, x451 y8 w41 h41 vPos1, 
Gui, Add, Picture, x392 y8 w41 h41 vPos2, 
Gui, Add, Picture, x322 y8 w41 h41 vPos3, 
Gui, Add, Picture, x248 y8 w41 h41 vPos4, 
Gui, Add, Picture, x163 y8 w41 h41 vPos5, 
Gui, Add, Picture, x8 y8 w41 h41 vPos6, 
Gui, Show, x189 y179 h113 w516, New

New_Index := 1
New_Index2 := 2
Loop 6
{
	sleep 1000
	New_Index ++
	New_Index2 ++
	GuiControl, , pos%A_Index%, blue.png
	GuiControl, , pos%New_Index%, orange.png
	GuiControl, , pos%New_Index2%, green.png
	Index := A_Index - 1
	GuiControl, , pos%Index%, 
	if Add = 1
	{
		Add_Index := A_Index - 1
		GuiControl, , pos%Add_Index%, green.png
		Index --
		GuiControl, , pos%Index%,
	}
}
Return

Add:
Add = 1

return

GuiClose:
ExitApp
</code></pre></div>]]></content>
			<author>
				<name><![CDATA[qwerlog]]></name>
				<uri>https://forum.script-coding.com/profile.php?id=31302</uri>
			</author>
			<updated>2019-04-03T22:17:30Z</updated>
			<id>https://forum.script-coding.com/viewtopic.php?pid=133336#p133336</id>
		</entry>
		<entry>
			<title type="html"><![CDATA[Re: AHK: Добавление в цикл нового параметра]]></title>
			<link rel="alternate" href="https://forum.script-coding.com/viewtopic.php?pid=133335#p133335" />
			<content type="html"><![CDATA[<p><strong>serzh82saratov</strong> Извините, просто не достают пару изображений, чтобы было понятней. Но перемещения не обязательно должны быть такими как у меня в коде, просто я ничего умнее или проще не придумал.<br /><a href="https://i.imgur.com/cvRnQ5Y.png">https://i.imgur.com/cvRnQ5Y.png</a> - load.png<br /><a href="https://i.imgur.com/dCxsdYC.png">https://i.imgur.com/dCxsdYC.png</a> - blue.png<br /><a href="https://i.imgur.com/xAKqChC.png">https://i.imgur.com/xAKqChC.png</a> - orange.png<br /><a href="https://i.imgur.com/u1sTgUl.png">https://i.imgur.com/u1sTgUl.png</a> - green.png</p>]]></content>
			<author>
				<name><![CDATA[qwerlog]]></name>
				<uri>https://forum.script-coding.com/profile.php?id=31302</uri>
			</author>
			<updated>2019-04-03T21:35:35Z</updated>
			<id>https://forum.script-coding.com/viewtopic.php?pid=133335#p133335</id>
		</entry>
		<entry>
			<title type="html"><![CDATA[Re: AHK: Добавление в цикл нового параметра]]></title>
			<link rel="alternate" href="https://forum.script-coding.com/viewtopic.php?pid=133333#p133333" />
			<content type="html"><![CDATA[<p>Ну, раз уже Вы не приводите код с <em>самим</em> перемещением, то могу только весёлым примером помочь.<br /></p><div class="codebox"><pre><code>
#SingleInstance Force 
#NoEnv
SetBatchLines -1
ListLines Off

deg = 0.01745329252  
r := 422
s := 48
sa := r * 2 + s
xob := (sa - 200) / 2 

Gui, -DPIScale 
Gui, Color, FFFFFF
Gui, Margin, 0, 0  
Gui Add, Text, w%sa% h%sa%  
Gui, Font, s22
Gui Add, Button, y+20 x%xob% w200 gAdd vAdd Default, Добавить
Gui, Font, s40
Gui Show
Count := 0

; SetTimer, Add, 1

loop
	loop 180  
	{ 
		i := A_Index
		loop % Count 
		{
			v := (A_Index - 1) // 18
			rn :=  r - s * v
			off := s * v
			MoveCircle(A_Index, rn, deg  * (((i - A_Index * 10) * 2) - 90), off) 
		}
		Sleep 10
	}
Return 

MoveCircle(idx, r, angle, off) {
	GuiControl, Move, Smile%idx%, % &quot;x&quot; Round(r+r*cos(angle)) + off &quot; y&quot; Round(r+r*sin(angle)) + off
} 

Add:  
	If (Count = 18 * 6) 
	{
		GuiControl, Disable, Add
		Return
	}
	++Count 
	Random, Color, 0, 0xFFFF00
	Gui Add, Text, vSmile%Count% x-32000 y-32000 w%s% h%s% c%Color% +0x201, % Chr(0x263a)  
    Return
	
GuiEscape:
GuiClose:
	ExitApp  
</code></pre></div>]]></content>
			<author>
				<name><![CDATA[serzh82saratov]]></name>
				<uri>https://forum.script-coding.com/profile.php?id=27879</uri>
			</author>
			<updated>2019-04-03T21:21:25Z</updated>
			<id>https://forum.script-coding.com/viewtopic.php?pid=133333#p133333</id>
		</entry>
		<entry>
			<title type="html"><![CDATA[AHK: Добавление в цикл нового параметра]]></title>
			<link rel="alternate" href="https://forum.script-coding.com/viewtopic.php?pid=133331#p133331" />
			<content type="html"><![CDATA[<p>Приветсвую всех! В общем, такая ситуация. Есть код, в нем циклично передвигаются определенные предметы, никак не могу додуматься как в цикл добавить еще один параметр, то есть &quot;Квадратик&quot;. Точнее чтобы их можно было добавлять неограниченно и они с такой же последовательностью передвигались за крайним.</p><div class="codebox"><pre><code>Gui, Add, Picture, x2 y-1 w510 h60 , load.png
Gui, Add, Button, x222 y69 w100 h30 gAdd, Добавить
Gui, Add, Picture, x451 y8 w41 h41 vPos1, 
Gui, Add, Picture, x392 y8 w41 h41 vPos2, 
Gui, Add, Picture, x322 y8 w41 h41 vPos3, 
Gui, Add, Picture, x248 y8 w41 h41 vPos4, 
Gui, Add, Picture, x163 y8 w41 h41 vPos5, 
Gui, Add, Picture, x8 y8 w41 h41 vPos6, 
Gui, Show, x189 y179 h113 w516, New

New_Index := 1
New_Index2 := 2
Loop 6
{
	New_Index ++
	New_Index2 ++
	GuiControl, , pos%A_Index%, blue.png
	GuiControl, , pos%New_Index%, orange.png
	GuiControl, , pos%New_Index2%, green.png
	Index := A_Index - 1
	GuiControl, , pos%Index%, 
	sleep 1000
}
Return

Add:


return

GuiClose:
ExitApp
</code></pre></div><p>Изображения:<br /><a href="https://i.imgur.com/cvRnQ5Y.png">https://i.imgur.com/cvRnQ5Y.png</a> - load.png<br /><a href="https://i.imgur.com/dCxsdYC.png">https://i.imgur.com/dCxsdYC.png</a> - blue.png<br /><a href="https://i.imgur.com/xAKqChC.png">https://i.imgur.com/xAKqChC.png</a> - orange.png<br /><a href="https://i.imgur.com/u1sTgUl.png">https://i.imgur.com/u1sTgUl.png</a> - green.png</p>]]></content>
			<author>
				<name><![CDATA[qwerlog]]></name>
				<uri>https://forum.script-coding.com/profile.php?id=31302</uri>
			</author>
			<updated>2019-04-03T20:07:57Z</updated>
			<id>https://forum.script-coding.com/viewtopic.php?pid=133331#p133331</id>
		</entry>
</feed>
