<?xml version="1.0" encoding="utf-8"?>
<feed xmlns="http://www.w3.org/2005/Atom">
	<title type="html"><![CDATA[Серый форум &mdash; AHK: изменение клавиши, которая нажимается в цикле, через GUI]]></title>
	<link rel="self" href="https://forum.script-coding.com/extern.php?action=feed&amp;tid=17947&amp;type=atom" />
	<updated>2023-09-20T16:17:39Z</updated>
	<generator>PunBB</generator>
	<id>https://forum.script-coding.com/viewtopic.php?id=17947</id>
		<entry>
			<title type="html"><![CDATA[Re: AHK: изменение клавиши, которая нажимается в цикле, через GUI]]></title>
			<link rel="alternate" href="https://forum.script-coding.com/viewtopic.php?pid=159210#p159210" />
			<content type="html"><![CDATA[<div class="codebox"><pre><code>Send {%Key3%}</code></pre></div>]]></content>
			<author>
				<name><![CDATA[teadrinker]]></name>
				<uri>https://forum.script-coding.com/profile.php?id=24515</uri>
			</author>
			<updated>2023-09-20T16:17:39Z</updated>
			<id>https://forum.script-coding.com/viewtopic.php?pid=159210#p159210</id>
		</entry>
		<entry>
			<title type="html"><![CDATA[AHK: изменение клавиши, которая нажимается в цикле, через GUI]]></title>
			<link rel="alternate" href="https://forum.script-coding.com/viewtopic.php?pid=159207#p159207" />
			<content type="html"><![CDATA[<p>Для полного удобства хочу изменять клавишу (переменная Key3), которая нажимается в цикле. Как я уже понял, мой вариант неправильный. Покурил чужой код и гайды, понял, что нужно реализовывать через Hotkey (или нет?). Но толково реализоваться у себя я не смог.<br />Если {Key3} заменить, к примеру, на {VK42} (клавиша B англ), то всё отлично работает, но тогда жёстко привязывает скрипт к какой-то одной клавише.</p><p>Добавлено: Почти разобрался. Вместо send {Key3} нужно было использовать SendInput, % Key3. НО, работает это только для клавиш из 1-го символа (1-9, a-z и прочее). F1-F12 так внести не получается.</p><p>Вот фрагмент кода GUI:<br /></p><div class="codebox"><pre><code>Gui, Tab, 3 ; Сундуки

			Gui, add, text,, Сундук на кнопке
			Gui, Add, Edit, w25 vKey3, 1

			Gui, add, text,, Пауза между прожатиями, мс
			Gui, Add, Edit, w40 vTime, 4000
			Gui, Add, Button, default, Применить
			Gui, Add, Button, y+10 gTest, Test
			Gui, Add, Button, x+10 gTest2, Test2
			Gui, Add, GroupBox, w275 h75 y+60,
			Gui, Add, Button, gLabel4 xp+10 yp+20 w40 h40, Старт
			Gui, Add, Button, gStop x+10 w40 h40, Стоп
			Gui, Add, Button, x+125 w40 h40, Выход

			Gui, Show</code></pre></div><p>И вот фрагмент кода:<br /></p><div class="codebox"><pre><code>		{ ; сундуки по кнопке

			isRunning := false ; переменная

			Label4: ; цикл для переменной

				ifwinexist, Perfect World
					WinActivate
				sleep 1000

				if (isRunning) {
					isRunning := false
					return
								}
				isRunning := true
				GoSub Label5
			return

			Label5:
				Loop {
					if (!isRunning)
					break
					send {Key3} ; &lt;-----------------------
					sleep Time
					}
			return
		}</code></pre></div>]]></content>
			<author>
				<name><![CDATA[solodrel]]></name>
				<uri>https://forum.script-coding.com/profile.php?id=43338</uri>
			</author>
			<updated>2023-09-20T06:07:40Z</updated>
			<id>https://forum.script-coding.com/viewtopic.php?pid=159207#p159207</id>
		</entry>
</feed>
