Тема: AHK:Сохранение переменной в конфигурационный файл
Возникла проблема при сохранении/считывании переменных, кусок скрипта
Gui,Add,Edit,vText1 x+10 w200 h18
Gui,Add,Hotkey,vmyhotkey1 x+15 w45
Gui,Add, Button, x10 y50 , Save
Вы не вошли. Пожалуйста, войдите или зарегистрируйтесь.
Страницы 1
Чтобы отправить ответ, вы должны войти или зарегистрироваться
Возникла проблема при сохранении/считывании переменных, кусок скрипта
Gui,Add,Edit,vText1 x+10 w200 h18
Gui,Add,Hotkey,vmyhotkey1 x+15 w45
Gui,Add, Button, x10 y50 , Save
Кусок ссылки на раздел статьи содержащий ответ : Gui, Submit
Нужно сохранить значения переменных обоих полей в конфигурационный файл, но у меня с этим накладочка произошла
Gui,Add,Picture ,xm y+10
Gui,Add,Edit,vText1 x+10 w200 h18
Gui,Add,Hotkey,vmyhotkey1 x+15 w45
Gui,Add, Button, x10 y40 , Save
Gui,Show,c000000,Тест
Return
ButtonSave:
IfNotExist, Тест.ini ; Если файла ini не находит - создает, с днфолтными параметрами
{
FileAppend, [Тест]
IniWrite, %myhotkey1%, %A_ScriptDir%\тест.ini, Options, vmyhotkey1
}
GuiControlGet, myhotkey1,, myhotkey1
GuiControlGet, Text1,, Text1
Gui, Destroy
Hotkey, $%myhotkey1%, textdown1, On
Return
Loop, 2
IniRead, Input_%A_Index%
, % A_ScriptDir "\"SubStr(A_ScriptName, 1, -4)".ini"
, Set
, Input_%A_Index%
, % A_Index=1 ? "temporary empty field":""
BuildGUI:
;Gui, Add, Picture, xm y+10
Gui, Add, Edit, vInput_1 x+10 w200 h18, % Input_1
Gui, Add, Hotkey, vInput_2 x+15 w45, % Input_2
Gui, Add, Button, x10 y40, Save
Gui, Show,, Test
Return
ButtonSave:
Gui, Submit
Gui, Destroy
Loop, 2
If !Input_%A_Index%
{
MsgBox, 262160,, % "make input! (field: "A_Index ")", 1
Goto, BuildGUI
}
Loop, 2
IniWrite, % Input_%A_Index%
, % A_ScriptDir "\"SubStr(A_ScriptName, 1, -4)".ini"
, Set
, Input_%A_Index%
ExitApp
GuiClose:
ExitApp
Grey, благодарю, еще один нюанс, как вывести текст по нажатию клавиши из переменных в sendinput?
Loop, 2
IniRead, Input_%A_Index%
, % A_ScriptDir "\"SubStr(A_ScriptName, 1, -4)".ini"
, Set
, Input_%A_Index%
, % A_Index=1 ? "temporary empty field":""
Gui, Add, Edit, vInput_1 x+10 w200 h18, % Input_1
Gui, Add, Hotkey, vInput_2 x+15 w45, % Input_2
Gui, Add, Button, x10 y40, Save
ShowGUI:
Hotkey, Ctrl & Enter, ShowGUI, Off ; call GUI hotkey
If % Input_2<>"ERROR"
Hotkey, % "$"Input_2, InputText, Off
Gui, Show,, Test
Return
ButtonSave:
Gui, Submit
Gui, Hide
Loop, 2
If !Input_%A_Index%
{
MsgBox, 262160, % "field: "A_Index, % "make input!", 1
Goto, ShowGUI
}
Loop, 2
IniWrite, % Input_%A_Index%
, % A_ScriptDir "\"SubStr(A_ScriptName, 1, -4)".ini"
, Set
, Input_%A_Index%
Hotkey, Ctrl & Enter, ShowGUI, On
Hotkey, % "$"Input_2, InputText, On
Return
InputText:
SendInput, % "{Raw}"Input_1
Return
GuiClose:
ExitApp
Страницы 1
Чтобы отправить ответ, вы должны войти или зарегистрироваться