<?xml version="1.0" encoding="utf-8"?>
<feed xmlns="http://www.w3.org/2005/Atom">
	<title type="html"><![CDATA[Серый форум &mdash; AHK: Сочетание клавиш через config.ini]]></title>
	<link rel="self" href="https://forum.script-coding.com/extern.php?action=feed&amp;tid=13503&amp;type=atom" />
	<updated>2018-03-05T18:35:57Z</updated>
	<generator>PunBB</generator>
	<id>https://forum.script-coding.com/viewtopic.php?id=13503</id>
		<entry>
			<title type="html"><![CDATA[Re: AHK: Сочетание клавиш через config.ini]]></title>
			<link rel="alternate" href="https://forum.script-coding.com/viewtopic.php?pid=123937#p123937" />
			<content type="html"><![CDATA[<p><strong>Oomniq</strong><br />Согласен, не всерьез, но пример то зачитан.</p>]]></content>
			<author>
				<name><![CDATA[shahlik002]]></name>
				<uri>https://forum.script-coding.com/profile.php?id=37352</uri>
			</author>
			<updated>2018-03-05T18:35:57Z</updated>
			<id>https://forum.script-coding.com/viewtopic.php?pid=123937#p123937</id>
		</entry>
		<entry>
			<title type="html"><![CDATA[Re: AHK: Сочетание клавиш через config.ini]]></title>
			<link rel="alternate" href="https://forum.script-coding.com/viewtopic.php?pid=123935#p123935" />
			<content type="html"><![CDATA[<p><strong>shahlik002</strong><br />Мне кажется, Inputbox не очень подходит для задания горячей клавиши.</p><p><strong>mtc_err</strong><br />Написал вот такой вариант на скорую руку без возможности нормально проверить:<br /></p><div class="codebox"><pre><code>ini2=%A_WorkingDir%\название файла.ini
none:=									;переменная для страховки от ошибок
iniread,Screenshot,%ini2%,Название группы клавиш,Имя1			;чтение из существующего файла
if (Screenshot=&quot;error&quot; or Screenshot=none)
	Screenshot:=&quot;sc42&quot;						;сверка на наличие ошибок - если переменная горячей клавиши ничего не содержит или вызывает ошибку при чтении, насильно назначает её на F8
	else
	Screenshot:=GetHotkeySC(Screenshot)				;в остальных случаях читает её из файла

Gui, set:Add, button, x50 y30 w125 h23 center gnichego, Применить
Gui, set:Add, Text, x5 y79 w250 h15 +BackgroundTrans, Клавиша:
Gui, set:Add, Hotkey, x240 y75 w80 h20 vcisScreenshot, %Screenshot%
Gui, set:Add, button, x2 y100 w125 h23 center, Сохранить
Gui, set:Add, button, x200 y100 w120 h23 center, Закрыть настройки
Gui, set:Show, w322 h125, %AppName% » Настройки
Hotkey, % Screenshot, on, UseErrorLevel
Hotkey, % Screenshot, work, UseErrorLevel					;здесь горячая клавиша привязывается к процедуре
return

work:
Screenshot := (GUISys.isScreenshot)
SendChat(&quot;/time&quot;)
Sleep 250
SendInput {%Screenshot%}
return

nichego:
Hotkey, % Screenshot, off, UseErrorLevel					;на случай если происходит смена горячей клавиши отключает функционал текущей
GuiControlGet,Screenshot,,cisscreenshot
IniWrite,%Screenshot%,%ini2%,Название группы клавиш,Имя1
Hotkey, % Screenshot, on, UseErrorLevel
Hotkey, % Screenshot, work, UseErrorLevel
return

GetHotkeySC(hotkey)  {
   RegExMatch(hotkey, &quot;([!^+#]*)(.*)&quot;, key)
   Return key1 . ((StrLen(key2) = 1 || InStr(key2, &quot;Num&quot;)) ? Format(&quot;sc{:X}&quot;, GetKeySC(key2)) : key2)
}
return</code></pre></div>]]></content>
			<author>
				<name><![CDATA[Oomniq]]></name>
				<uri>https://forum.script-coding.com/profile.php?id=34229</uri>
			</author>
			<updated>2018-03-05T17:32:12Z</updated>
			<id>https://forum.script-coding.com/viewtopic.php?pid=123935#p123935</id>
		</entry>
		<entry>
			<title type="html"><![CDATA[Re: AHK: Сочетание клавиш через config.ini]]></title>
			<link rel="alternate" href="https://forum.script-coding.com/viewtopic.php?pid=123934#p123934" />
			<content type="html"><![CDATA[<p><strong>shahlik002</strong> спасибо)</p>]]></content>
			<author>
				<name><![CDATA[mtc_err]]></name>
				<uri>https://forum.script-coding.com/profile.php?id=39106</uri>
			</author>
			<updated>2018-03-05T17:29:21Z</updated>
			<id>https://forum.script-coding.com/viewtopic.php?pid=123934#p123934</id>
		</entry>
		<entry>
			<title type="html"><![CDATA[Re: AHK: Сочетание клавиш через config.ini]]></title>
			<link rel="alternate" href="https://forum.script-coding.com/viewtopic.php?pid=123932#p123932" />
			<content type="html"><![CDATA[<div class="codebox"><pre><code>IniRead ,key,hotkey.ini,1,key,Space
if (key=f1 or key=)
	key=space
MsgBox % key
Hotkey,%key%,label
return
Label:
indx++
ToolTip % indx
return

f1::
InputBox,key2
if key=f2
{
	MsgBox nea
	return
}
IniWrite,%key2%,hotkey.ini,1,key
Reload

Esc::
IniWrite,%key2%,hotkey.ini,1,key
ExitApp</code></pre></div>]]></content>
			<author>
				<name><![CDATA[shahlik002]]></name>
				<uri>https://forum.script-coding.com/profile.php?id=37352</uri>
			</author>
			<updated>2018-03-05T17:04:20Z</updated>
			<id>https://forum.script-coding.com/viewtopic.php?pid=123932#p123932</id>
		</entry>
		<entry>
			<title type="html"><![CDATA[Re: AHK: Сочетание клавиш через config.ini]]></title>
			<link rel="alternate" href="https://forum.script-coding.com/viewtopic.php?pid=123895#p123895" />
			<content type="html"><![CDATA[<p><strong>ypppu</strong> напишите пожалуйста пример. Не совсем понял.</p>]]></content>
			<author>
				<name><![CDATA[mtc_err]]></name>
				<uri>https://forum.script-coding.com/profile.php?id=39106</uri>
			</author>
			<updated>2018-03-03T14:29:20Z</updated>
			<id>https://forum.script-coding.com/viewtopic.php?pid=123895#p123895</id>
		</entry>
		<entry>
			<title type="html"><![CDATA[Re: AHK: Сочетание клавиш через config.ini]]></title>
			<link rel="alternate" href="https://forum.script-coding.com/viewtopic.php?pid=123889#p123889" />
			<content type="html"><![CDATA[<p>Сохраняет настрйки команда IniWrite: <span style="color: navy"><strong>IniWrite, Value, Filename, Section, Key</strong></span>.</p><p>Считывает настройки команда IniRead: <span style="color: navy"><strong>IniRead, OutputVar, Filename, Section, Key [, Default]</strong></span>.</p><p>Включает/выключает горячие клавиши команда Hotkey: <span style="color: navy"><strong>Hotkey, KeyName [, Label, Options]</strong></span>.</p><p>Чтобы введённую горячую клавишу сохранить в переменную vcisScreenshot, используйте команду GUI, Submit.</p>]]></content>
			<author>
				<name><![CDATA[ypppu]]></name>
				<uri>https://forum.script-coding.com/profile.php?id=5974</uri>
			</author>
			<updated>2018-03-03T10:11:03Z</updated>
			<id>https://forum.script-coding.com/viewtopic.php?pid=123889#p123889</id>
		</entry>
		<entry>
			<title type="html"><![CDATA[AHK: Сочетание клавиш через config.ini]]></title>
			<link rel="alternate" href="https://forum.script-coding.com/viewtopic.php?pid=123887#p123887" />
			<content type="html"><![CDATA[<p>Приветствую. Такой вопрос: как сделать изменения клавиш через config.ini?</p><p>Например: чтобы в поля ввода &lt;&lt;Hotkey&gt;&gt; (назначение клавиш) - сохраняло в config.ini, и соответственно содействовало назначенное в скрипте.</p><div class="codebox"><pre><code>
Gui, set:Add, Text, x5 y79 w250 h15 +BackgroundTrans, Клавиша:
Gui, set:Add, Hotkey, x240 y75 w80 h20 vcisScreenshot, %Screenshot%
Gui, set:Add, button, x2 y100 w125 h23 center gsaveSetting, Сохранить
Gui, set:Add, button, x200 y100 w120 h23 center gsetGuiClose, Закрыть настройки
Gui, set:Show, Hide w322 h125, %AppName% » Настройки

(sc42):: ; Тут нужно изменять клавишу через config.ini
Screenshot := (GUISys.isScreenshot)
SendChat(&quot;/time&quot;)
Sleep 250
SendInput {%Screenshot%}
return
</code></pre></div><p>Заранее спасибо!</p>]]></content>
			<author>
				<name><![CDATA[mtc_err]]></name>
				<uri>https://forum.script-coding.com/profile.php?id=39106</uri>
			</author>
			<updated>2018-03-03T09:01:02Z</updated>
			<id>https://forum.script-coding.com/viewtopic.php?pid=123887#p123887</id>
		</entry>
</feed>
