<?xml version="1.0" encoding="utf-8"?>
<feed xmlns="http://www.w3.org/2005/Atom">
	<title type="html"><![CDATA[Серый форум &mdash; AHK: Gui, Add, Hotkey, Как поставить свою кнопку.]]></title>
	<link rel="self" href="http://forum.script-coding.com/extern.php?action=feed&amp;tid=13945&amp;type=atom" />
	<updated>2018-07-19T16:34:49Z</updated>
	<generator>PunBB</generator>
	<id>http://forum.script-coding.com/viewtopic.php?id=13945</id>
		<entry>
			<title type="html"><![CDATA[Re: AHK: Gui, Add, Hotkey, Как поставить свою кнопку.]]></title>
			<link rel="alternate" href="http://forum.script-coding.com/viewtopic.php?pid=127164#p127164" />
			<content type="html"><![CDATA[<p>Здравствуйте!<br />Одна тема = один вопрос.<br />Если Вы будете всё, что Вас интересует, задавать в одной теме, то следует переименовать тему в &quot;Беседа с DaGer&quot; и придётся разбираться с дяденькой модератором.</p><p><em>SplashImage</em> - окно, не картинка. Лучше опишите цель, возможно, что есть другие способы её достичь.</p><p>И, пожалуйста, пользуйтесь знаками препинания. Они такие же участники в передаче смысла, как и слова:<br /></p><div class="quotebox"><blockquote><p>... и что можно придумать в место&nbsp; Sleepa к примеру активация на кнопку кнопки окно появляется и закрывается</p></blockquote></div><p>Ничего не понятно из словосочетания(казнить нельзя помиловать).</p>]]></content>
			<author>
				<name><![CDATA[KusochekDobra]]></name>
				<uri>http://forum.script-coding.com/profile.php?id=33846</uri>
			</author>
			<updated>2018-07-19T16:34:49Z</updated>
			<id>http://forum.script-coding.com/viewtopic.php?pid=127164#p127164</id>
		</entry>
		<entry>
			<title type="html"><![CDATA[Re: AHK: Gui, Add, Hotkey, Как поставить свою кнопку.]]></title>
			<link rel="alternate" href="http://forum.script-coding.com/viewtopic.php?pid=127163#p127163" />
			<content type="html"><![CDATA[<div class="codebox"><pre><code>
   SplashImage,, y450 x800 w100 h50 ,, 
   Sleep 8000
</code></pre></div><p>Люди добрые подскажите, как поставить в окошко это картинку, как сделать чтобы мышкой нельзя было нажимать, игнорировать случайное нажатие на нее, и что можно придумать в место&nbsp; Sleepa к примеру активация на кнопку кнопки окно появляется и закрывается</p>]]></content>
			<author>
				<name><![CDATA[DaGer]]></name>
				<uri>http://forum.script-coding.com/profile.php?id=39390</uri>
			</author>
			<updated>2018-07-19T15:40:41Z</updated>
			<id>http://forum.script-coding.com/viewtopic.php?pid=127163#p127163</id>
		</entry>
		<entry>
			<title type="html"><![CDATA[Re: AHK: Gui, Add, Hotkey, Как поставить свою кнопку.]]></title>
			<link rel="alternate" href="http://forum.script-coding.com/viewtopic.php?pid=127162#p127162" />
			<content type="html"><![CDATA[<p><strong>qqlexa</strong> Не нужно это, я просто код с черновика скопировал для примера</p>]]></content>
			<author>
				<name><![CDATA[DaGer]]></name>
				<uri>http://forum.script-coding.com/profile.php?id=39390</uri>
			</author>
			<updated>2018-07-19T15:22:00Z</updated>
			<id>http://forum.script-coding.com/viewtopic.php?pid=127162#p127162</id>
		</entry>
		<entry>
			<title type="html"><![CDATA[Re: AHK: Gui, Add, Hotkey, Как поставить свою кнопку.]]></title>
			<link rel="alternate" href="http://forum.script-coding.com/viewtopic.php?pid=127161#p127161" />
			<content type="html"><![CDATA[<div class="quotebox"><cite>qqlexa пишет:</cite><blockquote><p>serzh82saratov, всё понятно кроме этого:</p></blockquote></div><p>ТС точно знает зачем, но никому не рассказывает.</p>]]></content>
			<author>
				<name><![CDATA[serzh82saratov]]></name>
				<uri>http://forum.script-coding.com/profile.php?id=27879</uri>
			</author>
			<updated>2018-07-19T14:44:55Z</updated>
			<id>http://forum.script-coding.com/viewtopic.php?pid=127161#p127161</id>
		</entry>
		<entry>
			<title type="html"><![CDATA[Re: AHK: Gui, Add, Hotkey, Как поставить свою кнопку.]]></title>
			<link rel="alternate" href="http://forum.script-coding.com/viewtopic.php?pid=127159#p127159" />
			<content type="html"><![CDATA[<p>Ооо Спасибо большое</p>]]></content>
			<author>
				<name><![CDATA[DaGer]]></name>
				<uri>http://forum.script-coding.com/profile.php?id=39390</uri>
			</author>
			<updated>2018-07-19T14:12:44Z</updated>
			<id>http://forum.script-coding.com/viewtopic.php?pid=127159#p127159</id>
		</entry>
		<entry>
			<title type="html"><![CDATA[Re: AHK: Gui, Add, Hotkey, Как поставить свою кнопку.]]></title>
			<link rel="alternate" href="http://forum.script-coding.com/viewtopic.php?pid=127158#p127158" />
			<content type="html"><![CDATA[<p><strong>serzh82saratov</strong>, всё понятно кроме этого:<br /></p><div class="codebox"><pre><code>
Key1:
	Loop 1 ; Зачем это
	{
		if not GetKeyState(&quot;Key1&quot; &quot;P&quot;) ; Что и зачем это
			SendInput, {1}{2}{3}{4}{5}
	}
	return

Key2:
	Loop 1 ; Зачем это
	{
		if not GetKeyState(&quot;Key2&quot; &quot;P&quot;) ; Что и зачем это
			SendInput, Всем привет!
	}
	return
</code></pre></div>]]></content>
			<author>
				<name><![CDATA[qqlexa]]></name>
				<uri>http://forum.script-coding.com/profile.php?id=39096</uri>
			</author>
			<updated>2018-07-19T14:11:00Z</updated>
			<id>http://forum.script-coding.com/viewtopic.php?pid=127158#p127158</id>
		</entry>
		<entry>
			<title type="html"><![CDATA[Re: AHK: Gui, Add, Hotkey, Как поставить свою кнопку.]]></title>
			<link rel="alternate" href="http://forum.script-coding.com/viewtopic.php?pid=127157#p127157" />
			<content type="html"><![CDATA[<p>Так проще?<br /></p><div class="codebox"><pre><code>
#UseHook
IniRead, Key1, IniFile.ini, Section, Key1, % A_Space
IniRead, Key2, IniFile.ini, Section, Key2, % A_Space 

Gui, Add, Hotkey, x12 y9 w90 h30 vKey1, % Key1
Gui, Add, Hotkey, x12 y49 w90 h30 vKey2, % Key2

Gui, Add, Button, x112 y9 w30 h30 gButton1, Button
Gui, Add, Button, x112 y49 w30 h30 gButton2, Button
Gui, Show, w157 h96, Untitled GUI
return

Button1:
	Gui, Submit, NoHide
	Hotkey, % PrKey1, off, UseErrorLevel
	Hotkey, % PrKey1 := Key1, Key1, on, UseErrorLevel
	IniWrite, % Key1, IniFile.ini, Section, Key1
	return

Button2:
	Gui, Submit, NoHide
	Hotkey, % PrKey2, off, UseErrorLevel
	Hotkey, % PrKey2 := Key2, Key2, on, UseErrorLevel
	IniWrite, % Key1, IniFile.ini, Section, Key2
	return 
	
Key1:
	Loop 1
	{
		if not GetKeyState(&quot;Key1&quot; &quot;P&quot;)
			SendInput, {1}{2}{3}{4}{5}
	}
	return

Key2:
	Loop 1
	{
		if not GetKeyState(&quot;Key2&quot; &quot;P&quot;)
			SendInput, Всем привет!
	}
	return

GuiClose:
	ExitApp
</code></pre></div>]]></content>
			<author>
				<name><![CDATA[serzh82saratov]]></name>
				<uri>http://forum.script-coding.com/profile.php?id=27879</uri>
			</author>
			<updated>2018-07-19T13:59:10Z</updated>
			<id>http://forum.script-coding.com/viewtopic.php?pid=127157#p127157</id>
		</entry>
		<entry>
			<title type="html"><![CDATA[Re: AHK: Gui, Add, Hotkey, Как поставить свою кнопку.]]></title>
			<link rel="alternate" href="http://forum.script-coding.com/viewtopic.php?pid=127154#p127154" />
			<content type="html"><![CDATA[<p>Как сделать статичные кнопки я разобрался,) спасибо, буду ждать тогда.<br />Мне пример исходник главное, как нибудь разберусь.</p>]]></content>
			<author>
				<name><![CDATA[DaGer]]></name>
				<uri>http://forum.script-coding.com/profile.php?id=39390</uri>
			</author>
			<updated>2018-07-19T12:01:46Z</updated>
			<id>http://forum.script-coding.com/viewtopic.php?pid=127154#p127154</id>
		</entry>
		<entry>
			<title type="html"><![CDATA[Re: AHK: Gui, Add, Hotkey, Как поставить свою кнопку.]]></title>
			<link rel="alternate" href="http://forum.script-coding.com/viewtopic.php?pid=127153#p127153" />
			<content type="html"><![CDATA[<p>Вот,&nbsp; попробуй простой пример. <br /></p><div class="codebox"><pre><code>Hotkey, F1, Key1
Hotkey, F2, Key2
return
Key1:
SendInput, 12345
return

Key2: 
SendInput, Всем привет!
return
</code></pre></div><p>Примеры скриптов выше,&nbsp; сложные для понимания новичкам и я думаю что стоит написать попроще примеры. Будет доступ к ПК - сделаю.</p>]]></content>
			<author>
				<name><![CDATA[qqlexa]]></name>
				<uri>http://forum.script-coding.com/profile.php?id=39096</uri>
			</author>
			<updated>2018-07-19T11:13:34Z</updated>
			<id>http://forum.script-coding.com/viewtopic.php?pid=127153#p127153</id>
		</entry>
		<entry>
			<title type="html"><![CDATA[Re: AHK: Gui, Add, Hotkey, Как поставить свою кнопку.]]></title>
			<link rel="alternate" href="http://forum.script-coding.com/viewtopic.php?pid=127152#p127152" />
			<content type="html"><![CDATA[<div class="codebox"><pre><code>
Key1:
SendInput, 12345
return

Key2: 
SendInput, Всем привет!
return
</code></pre></div><p>Я и так делал не работает, за <strong>Suspend</strong> спасибо</p>]]></content>
			<author>
				<name><![CDATA[DaGer]]></name>
				<uri>http://forum.script-coding.com/profile.php?id=39390</uri>
			</author>
			<updated>2018-07-19T10:40:53Z</updated>
			<id>http://forum.script-coding.com/viewtopic.php?pid=127152#p127152</id>
		</entry>
		<entry>
			<title type="html"><![CDATA[Re: AHK: Gui, Add, Hotkey, Как поставить свою кнопку.]]></title>
			<link rel="alternate" href="http://forum.script-coding.com/viewtopic.php?pid=127151#p127151" />
			<content type="html"><![CDATA[<p>Вот код для горячих клавиш: <br /></p><div class="codebox"><pre><code>Key1:
SendInput, 12345
return

Key2: 
SendInput, Всем привет!
return
</code></pre></div><p>Чтобы прекратить работу скрипта используйте <strong><span class="bbu"><em>ExitApp</em></span></strong>. <br />Для остановки/включения работы горячих клавиш <em><strong><span class="bbu">Suspend</span></strong></em>.</p>]]></content>
			<author>
				<name><![CDATA[qqlexa]]></name>
				<uri>http://forum.script-coding.com/profile.php?id=39096</uri>
			</author>
			<updated>2018-07-19T10:01:56Z</updated>
			<id>http://forum.script-coding.com/viewtopic.php?pid=127151#p127151</id>
		</entry>
		<entry>
			<title type="html"><![CDATA[Re: AHK: Gui, Add, Hotkey, Как поставить свою кнопку.]]></title>
			<link rel="alternate" href="http://forum.script-coding.com/viewtopic.php?pid=127150#p127150" />
			<content type="html"><![CDATA[<p><strong>qqlexa</strong> Поэтому и спрашиваю как можно сделать правильно, покажите на примере моего скрипта чтобы на одну кнопку считал от 1 до 5 а на другую кнопку писал предложение &quot;Всем привет!&quot; и как сделать чтобы выбранную кнопку можно было подтверждать. Спасибо заранее.<br />И еще один вопрос. Как можно сделать чтобы определенный скрипт выключать или отключать, как те же трейнеры отключают и включают скрипт не сворачивая игру определенной кнопкой.</p>]]></content>
			<author>
				<name><![CDATA[DaGer]]></name>
				<uri>http://forum.script-coding.com/profile.php?id=39390</uri>
			</author>
			<updated>2018-07-19T09:12:30Z</updated>
			<id>http://forum.script-coding.com/viewtopic.php?pid=127150#p127150</id>
		</entry>
		<entry>
			<title type="html"><![CDATA[Re: AHK: Gui, Add, Hotkey, Как поставить свою кнопку.]]></title>
			<link rel="alternate" href="http://forum.script-coding.com/viewtopic.php?pid=127149#p127149" />
			<content type="html"><![CDATA[<p><strong>DaGer</strong>,&nbsp; Нет доступа к ПК,&nbsp; поэтому сделаю замечания на код который может вызвать проблемы в работе скрипта. <br />Две метки с одинаковым названием: <br /></p><div class="codebox"><pre><code>
Gui, Add, Button, x112 y9 w30 h30 , Button
Gui, Add, Button, x112 y49 w30 h30 , Button
Gui, Show, w157 h96, Untitled GUI

return
GuiClose:
ExitApp

Button:
Gui, Submit, NoHide
Hotkey, Key1, Hotkey
return

Button:
Gui, Submit, NoHide
Hotkey, Key2, Hotkey
return
</code></pre></div><p>Бесполезные проверки в метках: <br /></p><div class="codebox"><pre><code>
Key1:
Loop 1
{
if not GetKeyState(&quot;Key1&quot; &quot;P&quot;)
SendInput, {1}{2}{3}{4}{5}
}
return

Key2:
Loop 1
{
if not GetKeyState(&quot;Key2&quot; &quot;P&quot;)
SendInput, Всем привет!
}
return
</code></pre></div>]]></content>
			<author>
				<name><![CDATA[qqlexa]]></name>
				<uri>http://forum.script-coding.com/profile.php?id=39096</uri>
			</author>
			<updated>2018-07-19T09:05:08Z</updated>
			<id>http://forum.script-coding.com/viewtopic.php?pid=127149#p127149</id>
		</entry>
		<entry>
			<title type="html"><![CDATA[Re: AHK: Gui, Add, Hotkey, Как поставить свою кнопку.]]></title>
			<link rel="alternate" href="http://forum.script-coding.com/viewtopic.php?pid=127146#p127146" />
			<content type="html"><![CDATA[<p>Спасибо большое, а как теперь привязать действие к кнопке чтобы он например считал или писал предложение, и как применять через Button?</p><div class="codebox"><pre><code>
IniRead, Key, IniFile.ini, Section, Key1, % A_Space
IniRead, Key, IniFile.ini, Section, Key2, % A_Space

Hotkey, % PrKey %A_DefaultGui% Key1 := Key, Action, On, UseErrorLevel
Hotkey, % PrKey %A_DefaultGui% Key2 := Key, Action, On, UseErrorLevel

Gui, Add, Hotkey, x12 y9 w90 h30 vKey1 gSave, % Key
Gui, Add, Hotkey, x12 y49 w90 h30 vKey2 gSave, % Key

Gui, Add, Button, x112 y9 w30 h30 , Button
Gui, Add, Button, x112 y49 w30 h30 , Button
Gui, Show, w157 h96, Untitled GUI

return
GuiClose:
ExitApp

Button:
Gui, Submit, NoHide
Hotkey, Key1, Hotkey
return

Button:
Gui, Submit, NoHide
Hotkey, Key2, Hotkey
return


Save:
Hotkey, % PrKey %A_Gui% %A_GuiControl%, off, UseErrorLevel
GuiControlGet, key, %A_Gui%:, %A_GuiControl%
Hotkey, % PrKey %A_Gui% %A_GuiControl% := key, Action, on, UseErrorLevel
IniWrite, % key, IniFile.ini, Section, % A_GuiControl
return

Key1:
Loop 1
{
if not GetKeyState(&quot;Key1&quot; &quot;P&quot;)
SendInput, {1}{2}{3}{4}{5}
}
return

Key2:
Loop 1
{
if not GetKeyState(&quot;Key2&quot; &quot;P&quot;)
SendInput, Всем привет!
}
return


</code></pre></div>]]></content>
			<author>
				<name><![CDATA[DaGer]]></name>
				<uri>http://forum.script-coding.com/profile.php?id=39390</uri>
			</author>
			<updated>2018-07-19T05:26:30Z</updated>
			<id>http://forum.script-coding.com/viewtopic.php?pid=127146#p127146</id>
		</entry>
		<entry>
			<title type="html"><![CDATA[Re: AHK: Gui, Add, Hotkey, Как поставить свою кнопку.]]></title>
			<link rel="alternate" href="http://forum.script-coding.com/viewtopic.php?pid=127145#p127145" />
			<content type="html"><![CDATA[<p>Много контролов и окон, обработка повторов.<br /></p><div class="codebox"><pre><code>

#SingleInstance Force
#NoEnv 

Loop 5
{
	GuiName := &quot;Gui&quot; A_Index 
	Gui, %GuiName%:+AlwaysOnTop -DPIScale +LabelGui
	
	Loop 15
	{
		IniRead, Key, IniFile.ini, Section, %GuiName%MyHotkey%A_Index%, % A_Space 
		func := Func(&quot;Action&quot;).Bind(GuiName, &quot;MyHotkey&quot; A_Index)
		Hotkey, % Arr()[GuiName &quot;MyHotkey&quot; A_Index] := Key, % func, On, UseErrorLevel 
		Gui, %GuiName%:Add, Text, +0x201 xm w20, % A_Index &quot;:&quot;
		Gui, %GuiName%:Add, Hotkey, vMyHotkey%A_Index% x+5 w200 gCheck, % Key   
	}
	Gui, %GuiName%:Show, % &quot;x&quot; 150 + 300 * (A_Index - 1), %GuiName%
}
Return

Check() {   
    Hotkey, % Arr()[A_Gui A_GuiControl], Off, UseErrorLevel
	func := Func(&quot;Action&quot;).Bind(A_Gui, A_GuiControl) 
    Hotkey, % Arr()[A_Gui A_GuiControl] := %A_GuiControl%, % func, On, UseErrorLevel
	IniWrite, % %A_GuiControl%, IniFile.ini, Section, % A_Gui A_GuiControl
}

Action(gui, name) {
	Static ThisPID := DllCall(&quot;GetCurrentProcessId&quot;)
	If WinActive(&quot;ahk_class AutoHotkeyGUI ahk_pid&quot; ThisPID)  
	{
		ToolTip % &quot;Уже назначено для:`n`n&quot; gui &quot;`n`n&quot; name, 5, 5 
		SetTimer, ToolTipHide, -550
		Return
	}
    MsgBox, 262208, Hotkey,% A_ThisHotkey &quot;`n`n&quot; gui &quot;`n`n&quot; name, 0.5
}

Arr() {
	Static Arr := {}
	Return Arr
}

ToolTipHide:
	ToolTip
	Return

GuiClose:
	ExitApp
</code></pre></div><br /><br /><div class="fancy_spoiler_switcher"><div class="fancy_spoiler_switcher_header"><strong>+</strong>&nbsp;Простой пример с 2 окнами.</div><div class="fancy_spoiler"><div class="codebox"><pre><code>
#SingleInstance Force
#NoEnv
  
Gui, New
Gui, +HWNDhGui1 +AlwaysOnTop

Loop % 15
{
	IniRead, Key, IniFile.ini, Section, Gui1MyHotkey%A_Index%, % A_Space
	func := Func(&quot;Action&quot;).Bind(&quot;Gui1&quot;, &quot;Gui1MyHotkey&quot; A_Index)
	Hotkey, % PrKeyGui1MyHotkey%A_Index% := Key, % func, On, UseErrorLevel
	Gui, Add, Hotkey, vMyHotkey%A_Index% gGui1, % Key
}
Gui, Show, x333

Gui, New
Gui, +HWNDhGui2 +AlwaysOnTop

Loop % 12
{
	IniRead, Key, IniFile.ini, Section, Gui2MyHotkey%A_Index%, % A_Space
	func := Func(&quot;Action&quot;).Bind(&quot;Gui2&quot;, &quot;Gui2MyHotkey&quot; A_Index)
	Hotkey, % PrKeyGui2MyHotkey%A_Index% := Key, % func, On, UseErrorLevel
	Gui, Add, Hotkey, vMyHotkey%A_Index% gGui2, % Key
}
Gui, Show, x666
Return

Gui1:
Gui2:
    Hotkey, % PrKey%A_ThisLabel%%A_GuiControl%, Off, UseErrorLevel
	
	func := Func(&quot;Action&quot;).Bind(A_ThisLabel, A_GuiControl)
	GuiControlGet, Key, %A_Gui%:, %A_GuiControl%
    Hotkey, % PrKey%A_ThisLabel%%A_GuiControl% := Key, % func, On, UseErrorLevel
	
	IniWrite, % Key, IniFile.ini, Section, %A_ThisLabel%%A_GuiControl%
    Return

Action(gui, name) {
	Global hGui1, hGui2
	If WinActive(&quot;ahk_id&quot; hGui1) || WinActive(&quot;ahk_id&quot; hGui2)
	{
		ToolTip Уже назначено, 5, 5
		SetTimer, ToolTipHide, -350
		Return
	}
    MsgBox,,, % A_ThisHotkey &quot;`n`n&quot; gui &quot;`n`n&quot; name, 0.5
}

ToolTipHide:
	ToolTip
	Return
</code></pre></div></div></div>]]></content>
			<author>
				<name><![CDATA[serzh82saratov]]></name>
				<uri>http://forum.script-coding.com/profile.php?id=27879</uri>
			</author>
			<updated>2018-07-19T00:32:25Z</updated>
			<id>http://forum.script-coding.com/viewtopic.php?pid=127145#p127145</id>
		</entry>
</feed>
