1

Тема: AHK: Gui, Hotkey, Сохранить HotKey в ini фаил.

Как сделать правильно?


IniRead, Key1, Save.ini, Section, KEY1, % A_Space
IniRead, Key2, Save.ini, Section, KEY2, % A_Space
IniRead, Key3, Save.ini, Section, KEY3, % A_Space
IniRead, Key4, Save.ini, Section, KEY4, % A_Space

Gui, Add, Hotkey, vA1, % KEY1
Gui, Add, Hotkey, vA2, % KEY2
Gui, Add, Hotkey, vA3, % KEY3
Gui, Add, Hotkey, vA4, % KEY4

Gui, Add, Button, gSave1, Save
Gui, Show


Save1:
Loop, 4
{
IniWrite, % Key1 Seve.ini, Section, KEY1
IniWrite, % Key2 Seve.ini, Section, KEY2
IniWrite, % Key3 Seve.ini, Section, KEY3
IniWrite, % Key4 Seve.ini, Section, KEY4
Hotkey, % A%A_Index%, off, UseErrorLevel
GuiControlGet, A%A_Index%
Hotkey, % A%A_Index%, A%A_index%, on, UseErrorLevel
}
return

A1:
{
SendInput, {1}{1}{1}{1}
}
return
A2:
{
SendInput, {2}{2}{2}{2}
}
return
A3:
{
SendInput, {3}{3}{3}{3}
}
return
A4:
{
SendInput, {4}{4}{4}{4}
}
return

2 (изменено: qqlexa, 2018-08-04 14:39:46)

Re: AHK: Gui, Hotkey, Сохранить HotKey в ini фаил.

Посмотрите внимательно на свой код:

IniRead, Key1, Save.ini, Section, KEY1, % A_Space
IniRead, Key2, Save.ini, Section, KEY2, % A_Space
IniRead, Key3, Save.ini, Section, KEY3, % A_Space
IniRead, Key4, Save.ini, Section, KEY4, % A_Space
IniWrite, % Key1 Seve.ini, Section, KEY1
IniWrite, % Key2 Seve.ini, Section, KEY2
IniWrite, % Key3 Seve.ini, Section, KEY3
IniWrite, % Key4 Seve.ini, Section, KEY4

Не замечаете различия в названиях ini файла?
Да и функцию IniWrite вы используете не верно.

3 (изменено: qqlexa, 2018-08-04 14:47:17)

Re: AHK: Gui, Hotkey, Сохранить HotKey в ini фаил.

Save1:
Loop, 4
{
Hotkey, % A%A_Index%, off, UseErrorLevel
GuiControlGet, A%A_Index%
Hotkey, % A%A_Index%, A%A_index%, on, UseErrorLevel
IniWrite, % A%A_Index%, Save.ini, Section, Key%A_Index%
}
return

4 (изменено: qqlexa, 2018-08-04 14:46:23)

Re: AHK: Gui, Hotkey, Сохранить HotKey в ini фаил.

Только не вижу смысла разделять хоткеи  на две переменные, используйте или  A1-4  или  Key1-4!

5

Re: AHK: Gui, Hotkey, Сохранить HotKey в ini фаил.

Все работает спасибо.