I'm pretty new to autohotkey so please explain things like you would a newbie. Thank you for your time.
EDIT: I was able to figure it out! I have revised my script below. It uses two other scripts that are included as classes that someone else made. If anyone would like to try out my script i can attach the classes and explain how the script works.
Here is my script file:
Code: Select all
#NoEnv ; Recommended for performance and compatibility with future AutoHotkey releases.
; #Warn ; Enable warnings to assist with detecting common errors.
#Include Class_ScrollGUI.ahk
#Include Class_INI.ahk
SendMode Input ; Recommended for new scripts due to its superior speed and reliability.
SetWorkingDir %A_ScriptDir% ; Ensures a consistent starting directory.
SetBatchLines, -1
; ----------------------------------------------------------------------------------------------------------------------
; Main Window GUI
Gui, New, +hwndHGUI +Resize
Gui, Margin, 2, 4
I := 0
inifile = general_settings.ini
INI_Init("general_settings.ini")
Gui, Add, Tab,, General|Import Options|Paths
Loop, %inisections%
{
FoundSection := A_index
section := Section%A_index%
numberOfKeys%A_index% := Section%A_index%_keys
loop, % numberOfKeys%A_index%
{
IniRead, %section%_val%A_index%, %inifile%, %section%, % Section%FoundSection%_key%A_index%, %A_Space%
value := %section%_val%A_index%
option := Section%FoundSection%_key%A_index%
;ListVars
;Msgbox, value=%value% option=%option%
IF value=enabled
{
Gui, Add, Checkbox, v%section%_checkbox%A_index% gSave Checked, % Section%FoundSection%_key%A_index%
}
ELSE IF value=disabled
{
Gui, Add, Checkbox, v%section%_checkbox%A_index% gSave, % Section%FoundSection%_key%A_index%
}
}
}
inifile = import_options.ini
INI_Init("import_options.ini")
Gui, Tab, Import Options
Loop, %inisections%
{
FoundSection := A_index
section := Section%A_index%
numberOfKeys%A_index% := Section%A_index%_keys
loop, % numberOfKeys%A_index%
{
IniRead, val%A_index%, %inifile%, %section%, % Section%FoundSection%_key%A_index%, %A_Space%
value := val%A_index%
option := Section%FoundSection%_key%A_index%
;ListVars
;Msgbox, value=%value% option=%option%
IF value=enabled
{
Gui, Add, Checkbox, v%section%_checkbox%A_index% gSave2 Checked, % Section%FoundSection%_key%A_index%
}
ELSE IF value=disabled
{
Gui, Add, Checkbox, v%section%_checkbox%A_index% gSave2, % Section%FoundSection%_key%A_index%
}
}
}
Gui, Tab, Paths
Gui, Add, Checkbox, vpath1, Test Path 1
Gui, Add, Checkbox, vpath2, Test Path 2
; Create ScrollGUI1 with both horizontal and vertical scrollbars and scrolling by mouse wheel
Global SG1 := New ScrollGUI(HGUI, 300, 200, "+Resize +LabelGui1", 3, 4)
; Show ScrollGUI1
SG1.Show("ScrollGUI1", "y0 xcenter")
Gui, Show
return
Save:
Gui, Submit, NoHide
inifile = general_settings.ini
INI_Init("general_settings.ini")
Loop, %inisections%
{
FoundSection := A_index
section := Section%A_index%
numberOfKeys%A_index% := Section%A_index%_keys
loop, % numberOfKeys%A_index%
{
IniRead, %section%_val%A_index%, %inifile%, %section%, % Section%FoundSection%_key%A_index%, %A_Space%
value := %section%_val%A_index%
option := Section%FoundSection%_key%A_index%
IfEqual, %section%_checkbox%A_index%, 1, IniWrite, enabled, %inifile%, %section%, %option%
IfEqual, %section%_checkbox%A_index%, 0, IniWrite, disabled, %inifile%, %section%, %option%
}
}
return
;Msgbox, option=%option% value=%value% section=%section% inifile=%inifile%
;Msgbox, rom_renamer = %rom_renamer%`nlaunch_steamconsole_on_startup = %launch_steamconsole_on_startup%
Save2:
Gui, Submit, NoHide
inifile = import_options.ini
INI_Init("import_options.ini")
Loop, %inisections%
{
FoundSection := A_index
section := Section%A_index%
numberOfKeys%A_index% := Section%A_index%_keys
loop, % numberOfKeys%A_index%
{
IniRead, %section%_val%A_index%, %inifile%, %section%, % Section%FoundSection%_key%A_index%, %A_Space%
value := %section%_val%A_index%
option := Section%FoundSection%_key%A_index%
IfEqual, %section%_checkbox%A_index%, 1, IniWrite, enabled, %inifile%, %section%, %option%
IfEqual, %section%_checkbox%A_index%, 0, IniWrite, disabled, %inifile%, %section%, %option%
}
}
return
;=======
;hotkeys
;=======
ESC::
ExitApp
Gui1Close:
Gui1Escape:
ExitApp
Gui1Size:
Return
Gui2Size:
Return
Gui2Close:
Gui2Escape:
SG2 := ""
Return
Code: Select all
[General]
Option1=disabled
Option2=enabled