<?xml version="1.0" encoding="utf-8"?>
<feed xmlns="http://www.w3.org/2005/Atom">
	<title type="html"><![CDATA[Серый форум &mdash; AHK: Проблемы с выполнением части "else" кода]]></title>
	<link rel="self" href="https://forum.script-coding.com/extern.php?action=feed&amp;tid=16255&amp;type=atom" />
	<updated>2021-04-12T18:57:39Z</updated>
	<generator>PunBB</generator>
	<id>https://forum.script-coding.com/viewtopic.php?id=16255</id>
		<entry>
			<title type="html"><![CDATA[Re: AHK: Проблемы с выполнением части "else" кода]]></title>
			<link rel="alternate" href="https://forum.script-coding.com/viewtopic.php?pid=147293#p147293" />
			<content type="html"><![CDATA[<p><strong>__Михаил__</strong><br />Задача скрипта -&nbsp; отображать точку в разных положениях через промежутки времени.<br />Это только часть кода, я пытался разобраться, почему не срабатывала часть кода после &quot;else&quot; и, поэтому, скопировал только первоначальные установки для дальнейших изменений, а не всю программу, в обе части &quot;if - else&quot;.<br />Я просто упростил код, но результат не изменился, &quot;else&quot; часть не работала.<br />В итоге мне помог знакомый. Как я понял, проблема оказалась в том, что я вписал &quot;goto, des&quot; и сам &quot;des&quot; в один цикл, хотя &quot;Gui Destroy&quot; должна быть в конце кода.<br />Уже проблема решена, спасибо, что ответили.</p>]]></content>
			<author>
				<name><![CDATA[Twilight]]></name>
				<uri>https://forum.script-coding.com/profile.php?id=41640</uri>
			</author>
			<updated>2021-04-12T18:57:39Z</updated>
			<id>https://forum.script-coding.com/viewtopic.php?pid=147293#p147293</id>
		</entry>
		<entry>
			<title type="html"><![CDATA[Re: AHK: Проблемы с выполнением части "else" кода]]></title>
			<link rel="alternate" href="https://forum.script-coding.com/viewtopic.php?pid=147277#p147277" />
			<content type="html"><![CDATA[<p>Задача от скрипта какая? Отобразить точку и тут же убрать?</p>]]></content>
			<author>
				<name><![CDATA[__Михаил__]]></name>
				<uri>https://forum.script-coding.com/profile.php?id=40928</uri>
			</author>
			<updated>2021-04-12T13:08:27Z</updated>
			<id>https://forum.script-coding.com/viewtopic.php?pid=147277#p147277</id>
		</entry>
		<entry>
			<title type="html"><![CDATA[Re: AHK: Проблемы с выполнением части "else" кода]]></title>
			<link rel="alternate" href="https://forum.script-coding.com/viewtopic.php?pid=147276#p147276" />
			<content type="html"><![CDATA[<p><strong>__Михаил__</strong><br />Это начальные установки двух похожих скриптов, поэтому много лишнего, но я уже разобрался. Спасибо, в любом случае.</p>]]></content>
			<author>
				<name><![CDATA[Twilight]]></name>
				<uri>https://forum.script-coding.com/profile.php?id=41640</uri>
			</author>
			<updated>2021-04-12T13:07:46Z</updated>
			<id>https://forum.script-coding.com/viewtopic.php?pid=147276#p147276</id>
		</entry>
		<entry>
			<title type="html"><![CDATA[Re: AHK: Проблемы с выполнением части "else" кода]]></title>
			<link rel="alternate" href="https://forum.script-coding.com/viewtopic.php?pid=147275#p147275" />
			<content type="html"><![CDATA[<p>Скорее всего проблема из-зa &quot;des&quot; внутри цикла, но сейчас все работает</p>]]></content>
			<author>
				<name><![CDATA[Twilight]]></name>
				<uri>https://forum.script-coding.com/profile.php?id=41640</uri>
			</author>
			<updated>2021-04-12T13:06:32Z</updated>
			<id>https://forum.script-coding.com/viewtopic.php?pid=147275#p147275</id>
		</entry>
		<entry>
			<title type="html"><![CDATA[Re: AHK: Проблемы с выполнением части "else" кода]]></title>
			<link rel="alternate" href="https://forum.script-coding.com/viewtopic.php?pid=147274#p147274" />
			<content type="html"><![CDATA[<p>Оптимизации в коде совсем мало. Зачем копировать всё подряд?</p>]]></content>
			<author>
				<name><![CDATA[__Михаил__]]></name>
				<uri>https://forum.script-coding.com/profile.php?id=40928</uri>
			</author>
			<updated>2021-04-12T13:01:26Z</updated>
			<id>https://forum.script-coding.com/viewtopic.php?pid=147274#p147274</id>
		</entry>
		<entry>
			<title type="html"><![CDATA[AHK: Проблемы с выполнением части "else" кода]]></title>
			<link rel="alternate" href="https://forum.script-coding.com/viewtopic.php?pid=147273#p147273" />
			<content type="html"><![CDATA[<p>Я новичок в ahk, пока в нем совсем не разбираюсь. Захотел объединить 2 части кода с помощью if/else, но скрипт никак не хочет выполнять вторую часть кода, хотя они идентичны. Код не очень длинный.<br /></p><div class="codebox"><pre><code>
GetKeyState, state, LButton

AK := true
m::
AK := !AK

Insert:: Hotkey, *~$LButton, Toggle
x := (A_ScreenWidth / 2)													;1
y := (A_ScreenHeight / 2)
*~$LButton::
 if(AK)
	 while GetKeyState(&quot;LButton&quot;), P
		{    
			x := (A_ScreenWidth / 2)													;1
			y := (A_ScreenHeight / 2)
			w = 3
			h = 3
			Color = 0xFF0000
			WS_EX_TRANSPARENT := 0x20
			WS_EX_LAYERED := 0x80000
			Gui, +AlwaysOnTop -Caption +ToolWindow +LastFound
			Gui, Color, % Color
			Gui, Show, x%x% y%y% w%w% h%h% NA
			WinSet, ExStyle, % &quot;+&quot; WS_EX_LAYERED|WS_EX_TRANSPARENT
			
			Sleep, 100
			
		des:
		Gui Destroy
		Return
		}
 else		
	 while GetKeyState(&quot;LButton&quot;), P
		{    
			x := (A_ScreenWidth / 2)													;1
			y := (A_ScreenHeight / 2)
			w = 3
			h = 3
			Color = 0xFF0000
			WS_EX_TRANSPARENT := 0x20
			WS_EX_LAYERED := 0x80000
			Gui, +AlwaysOnTop -Caption +ToolWindow +LastFound
			Gui, Color, % Color
			Gui, Show, x%x% y%y% w%w% h%h% NA
			WinSet, ExStyle, % &quot;+&quot; WS_EX_LAYERED|WS_EX_TRANSPARENT
			
			Sleep, 91
			
		des1:
		Gui Destroy
		Return
		}
</code></pre></div>]]></content>
			<author>
				<name><![CDATA[Twilight]]></name>
				<uri>https://forum.script-coding.com/profile.php?id=41640</uri>
			</author>
			<updated>2021-04-12T11:27:22Z</updated>
			<id>https://forum.script-coding.com/viewtopic.php?pid=147273#p147273</id>
		</entry>
</feed>
