How to save data from GUI elements in a file/log ?

Get help with using AutoHotkey and its commands and hotkeys
CroW
Posts: 1
Joined: 22 Sep 2019, 02:34

How to save data from GUI elements in a file/log ?

22 Sep 2019, 02:37

Good afternoon, I wondered today ..
How to make data from (chekbox, radio) stored in a hotel file, let's call it log

[Mod edit: Provisional topic name added]
User avatar
TheDewd
Posts: 1391
Joined: 19 Dec 2013, 11:16
Location: USA

Re: How to save data from GUI elements in a file/log ?

26 Sep 2019, 11:57

Give each control a variable name, and then use GuiSubmit to assign the control value to the chosen variable names.

Once you have the variable values assigned, you can write them to a text file for example using FileAppend.

Code: Select all

#SingleInstance, Force

Gui, Margin, 10, 10
Gui, Add, Checkbox, w200 vCB1, Checkbox1
Gui, Add, Checkbox, wp vCB2, Checkbox2
Gui, Add, Checkbox, wp vCB3, Checkbox3
Gui, Add, Checkbox, wp vCB4, Checkbox4
Gui, Add, Radio, wp yp+40 vRad1, Radio1
Gui, Add, Radio, wp vRad2, Radio2
Gui, Add, Radio, wp vRad3, Radio3
Gui, Add, Radio, wp vRad4, Radio4
Gui, Add, Button, w80 h26 yp+40 gSubmit, Submit
Gui, Show, AutoSize, Example
return

Submit:
	Gui, Submit, NoHide
	
	Temp := ""
	
	Temp .= "Checkbox 1: " CB1
	. "`nCheckbox 2: " CB2
	. "`nCheckbox 3: " CB3
	. "`nCheckbox 4: " CB4
	. "`nRadio 1: " Rad1
	. "`nRadio 2: " Rad2
	. "`nRadio 3: " Rad3
	. "`nRadio 4: " Rad4

	FileAppend, % Temp, MyLogFile.txt
	
	Run, MyLogFile.txt	
return
Image Bulldozer - Sokoban inspired game from 1994 recreated in AutoHotkey.

Return to “Ask For Help”

Who is online

Users browsing this forum: AHKStudent, Clemens375, euras, Google [Bot], songdg and 250 guests