Ahk todo list with input- and checkboxes Topic is solved

Get help with using AutoHotkey (v1.1 and older) and its commands and hotkeys
User avatar
RunarSF
Posts: 27
Joined: 01 Jul 2017, 11:48
Location: Norway
Contact:

Ahk todo list with input- and checkboxes

03 Dec 2017, 13:55

Let's get right to the point; I want to create a todo script/list, the only thing I'm struggling with atm is adding a checkbox and saving it's contents to an .ini file based on what is in an edit box. If I type "Finish todo script" in an edit box, it will create a checkbox with that text and save it's current state to an .ini file.
There are two kinds of people in the world: those who can extrapolate from incomplete data.
User avatar
Exaskryz
Posts: 2882
Joined: 17 Oct 2015, 20:28

Re: Ahk todo list with input- and checkboxes

03 Dec 2017, 16:20

What code do you have thus far?

I would guess you are making a GUI to come up with the Gui, Checkbox control ?

You can use Gui, Submit command to retrieve the value of the checkbox to record in an ini file.
User avatar
RunarSF
Posts: 27
Joined: 01 Jul 2017, 11:48
Location: Norway
Contact:

Re: Ahk todo list with input- and checkboxes

03 Dec 2017, 16:39

I know how to do the ini part, the other part is the difficult one, not really sure how I'm going to do it.

Code: Select all

#SingleInstance Force
#Persistent																							
SetTitleMatchMode 2																						
SetWorkingDir %A_ScriptDir%																				
DetectHiddenWindows, On																					
#EscapeChar ¤
CoordMode, Mouse, Screen


gui:
Gui, +AlwaysOnTop +LastFound +Caption
Gui, Color, 2f343f, 434852
WinSet, Transparent, 240
Gui, Font, s10 cBlack, Source code pro,
Gui, Add, Tab2, w390 h600, Tasks|Finished


; Tasks tab
Gui, Tab, Tasks,, Exact
Gui, Color, 2f343f, 2f343f

Gui, Add, Edit, w360 vTask r1, 
Gui, Add, Checkbox, vKey, Test

IniRead, MyVar, config.ini, Tasks, TaskName,
Gui, Add, Text,, %MyVar%
Gui, Add, Button, Default, OK
GuiControl, Hide, OK

; Finished tab
Gui, Tab, Finished,, Exact
Gui, Color, 2f343f, 2f343f


Gui, Show,, ToDo
IniRead, WinPossX, config.ini, Settings, WinPosX,
IniRead, WinPossY, config.ini, Settings, WinPosY,
WinMove, ahk_exe AutoHotkey.exe,, %WinPossX%, %WinPossY%
return
 
 
 
ButtonOK: 
WinGetPos, WinPosX, WinPosY,,, ahk_exe AutoHotkey.exe
IniWrite, %WinPosX%, config.ini, Settings, WinPosX
IniWrite, %WinPosY%, config.ini, Settings, WinPosY
Gui, Submit
IniWrite, %Key%, config.ini, Tasks, TaskName
reload
return

GuiClose: 
WinGetPos, WinPosX, WinPosY,,, ahk_exe AutoHotkey.exe
IniWrite, %WinPosX%, config.ini, Settings, WinPosX
IniWrite, %WinPosY%, config.ini, Settings, WinPosY
Gui, Destroy
ExitApp
return
There are two kinds of people in the world: those who can extrapolate from incomplete data.
Osprey
Posts: 453
Joined: 18 Nov 2017, 05:50

Re: Ahk todo list with input- and checkboxes  Topic is solved

03 Dec 2017, 16:39

Just to be clear, a checkbox's state is merely whether it's checked or not. You can save it to the INI file, but it will be a value of 0 or 1. It sounds like you're more interested in saving the contents of the edit box. The checkbox and edit box are different controls that have no relation to one another unless you establish a relationship, such as by checking the state of the checkbox to determine whether to enable or disable the edit box.

It sounds like you want something like...

Code: Select all

Gui, Add, Checkbox, vMyCheckBoxVar gMyCheckBoxSub, Add item to do
Gui, Add, Edit, Disabled vToDoItemVar
Gui, Add, Button, gSaveSub, Save
Gui, Show

MyCheckBoxSub:
  Gui, Submit, NoHide                      ; Save all states to variables so that we can check whether the checkbox has just been checked or unchecked
  If MyCheckBoxVar                         ; If the checkbox has been checked...
    GuiControl, Enable, ToDoItemVar        ; ...enable the edit box
  Else GuiControl, Disable, ToDoItemVar    ; ...otherwise, disable the edit box
return

SaveSub:
  Gui, Submit, NoHide                      ; Save all states to variables so that we can write what is in the edit box to the INI file
  ; Add IniWrite line here and use %ToDoItemVar% as the "value" to write
return

Return to “Ask for Help (v1)”

Who is online

Users browsing this forum: Bing [Bot] and 289 guests