Have another input box and append value to file
So I've been trying this out for quite some time and it really is a great idea to integrate gui to execute commands. Now I've been using AHK for several years now for convenience use, not a pro, and just recently just stumbled upon this gem. One thing I frequently do is try to document changes for a certain file every now and then. And was thinking if I can do it with a gui like this instead of opening the file every time and save it.. And as the title suggest is there a way to append the value of on the gui text field?
A bit late but i do the same to add autocorrection :
add this is the usercommand file :
else if Pedersen = ab
{
gui_search_title = add to autocorrect ::a::b <--how to write it
gui_AddAutocorrectfunction()
send, ::::
send, {left}
send, {Left}
}
and this in the gui.ahk :
gui_AddAutocorrectfunction()
{
global
if gui_state != search
{
gui_state = search
; if gui_state is "main", then we are coming from the main window and
; GUI elements for the search field have not yet been added.
Gosub, gui_autocorrect_add_elements
}
}
gui_autocorrect_add_elements:
Gui, Add, Text, %gui_control_options% %cYellow%, %gui_search_title%
Gui, Add, Edit, %gui_control_options% %cYellow% vgui_AutocorrectAddEdit -WantReturn
Gui, Add, Button, x-10 y-10 w1 h1 +default ggui_AddAutocorrect ; hidden button
GuiControl, Disable, Pedersen
Gui, Show, AutoSize
return
gui_AddAutocorrect:
Gui, Submit
gui_destroy()
FileAppend, %gui_AutocorrectAddEdit%`n, D:\Users\XXXX\Documents\AutoHotKey-Scripts-Master\AutoCorrectAutoComplete.ahk
; reload AutoCorrectAutoComplete.ahk
run, D:\Users\XXXX\Documents\AutoHotKey-Scripts-Master\AutoCorrectAutoComplete.ahk
return
Additionnaly, i have a run command : i type run, another gui appear and you can paste an url or a file path, or something to run :
else if Pedersen = run
{
gui_search_title := "run,"
gui_Addrunboxfunction()
}
and in gui.ahk :
gui_Addrunboxfunction()
{
global
if gui_state != search
{
gui_state = search
; if gui_state is "main", then we are coming from the main window and
; GUI elements for the search field have not yet been added.
Gosub, gui_Addrunbox
}
}
gui_Addrunbox:
Gui, Add, Text, %gui_control_options% %cYellow%, %gui_search_title%
Gui, Add, Edit, %gui_control_options% %cYellow% vgui_AddrunboxEdit -WantReturn
Gui, Add, Button, x-10 y-10 w1 h1 +default ggui_Addrunboxp2 ; hidden button
GuiControl, Disable, Pedersen
Gui, Show, AutoSize
return
gui_Addrunboxp2:
Gui, Submit
gui_destroy()
run, %gui_AddrunboxEdit%
;msgbox, %gui_AddrunboxEdit%
return
This is really useful @CCCBBBAAAHIGHSCORE. I was trying to do something like on my own, but couldn't make it work. Yours works like a charm. Thanks so much.