Skip to content

Commit acabfe5

Browse files
committed
v1.0.3 - add ini config file, update checker, opts saved
The update checker prompts to download if version is less than latest on github. The ini config saves options so they stay even after restart.
1 parent f1638a8 commit acabfe5

File tree

6 files changed

+457
-6
lines changed

6 files changed

+457
-6
lines changed

.gitignore

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,4 @@
11
*.bak
2-
*.exe
2+
*.exe
3+
test.ahk
4+
resize.ahk

Gui.ahk

Lines changed: 16 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
#Include XGraph.ahk
2+
#Include config.ahk
23
toggle :=false
34
trampRunning :=false
45
if A_IsCompiled
@@ -18,7 +19,7 @@ Gui +AlwaysOnTop
1819
Gui -DPIScale
1920
Gui, Margin, 0, 0
2021
Gui, font, s8
21-
Gui, Add, Text,h12 y5, Welcome to TTR Tools v1.0.2
22+
Gui, Add, Text,h12 y5, Welcome to TTR Tools %version%
2223
Gui, font, s7
2324
Gui, Add, Button, x+5 y0 ghelp, View Help
2425
Gui, font, s8
@@ -50,13 +51,18 @@ if(enableFeatureAFK || enableFeatureTrampoline)
5051
if(enableFeatureTrampoline)
5152
{
5253
;Gui, Add, checkbox,x+3 vspeedy gSave, Lagfix (>40)
53-
Gui, Add, checkbox,x+3 vrepeat Checked gSave, Repeat Trampoline
54+
if(iniRep == 1)
55+
Gui, Add, checkbox,x+3 vrepeat Checked gSave, Repeat Trampoline
56+
else if(iniRep== 0)
57+
Gui, Add, checkbox,x+3 vrepeat gSave, Repeat Trampoline
58+
else
59+
Gui, Add, checkbox,x+3 vrepeat Checked gSave, Repeat Trampoline
5460
}
5561
if(enableFeatureAFK)
5662
{
5763
Gui, Add, Text, x+0 vtextAFK,| AFK Time (mins):
58-
Gui, Add, Edit, h16 x+3 vtimeAFK gSave number, 8
59-
Gui, Add, UpDown, vtimeAFKUD Range1-11, 8
64+
Gui, Add, Edit, h16 x+3 vtimeAFK gSave number, %iniAFKMins%
65+
Gui, Add, UpDown, vtimeAFKUD Range1-11, %iniAFKMins%
6066
}
6167
}
6268
if(enableFeatureAFK || enableFeatureTrampoline)
@@ -102,6 +108,12 @@ Help::
102108
return
103109
Save:
104110
Gui, Submit, NoHide
111+
112+
; config.ahk update
113+
IniWrite, %repeat%, %ini%,Trampoline, repeat
114+
IniWrite, %timeAFK%, %ini%, AFK, afkMins
115+
; end config.ahk update
116+
105117
if(enableFeatureAFK)
106118
{
107119
if(timeAFK*60000 != timeMS)

TTR-Tools.ahk

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
/*
2-
Welcome to TTR Tools v1.0.0
2+
Welcome to TTR Tools.
3+
To check version number, look in config.ahk and default-conf.ini
34
Released under the GPL
45
Please be sure to follow the license
56

config.ahk

Lines changed: 47 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,47 @@
1+
#include json.ahk
2+
version = v1.0.3
3+
IfNotExist %A_AppData%\TTR-Tools\config.ini
4+
FileInstall, default-conf.ini, %A_AppData%\TTR-Tools\config.ini
5+
formatVersion( str ){
6+
versionNum1:= SubStr(str,2,1)
7+
versionNum2:= SubStr(str,4,1)
8+
versionNum3:= SubStr(str,6,1)
9+
full := versionNum1 . versionNum2 . VersionNum3
10+
return full
11+
}
12+
versionInt := formatVersion(version)
13+
ini = %A_AppData%\TTR-Tools\config.ini
14+
FileInstall, default-conf.ini, %A_AppData%\TTR-Tools\config.ini,0
15+
IniRead, iniVer, %ini%,TTR-Tools, version
16+
iniVersionInt := formatVersion(iniVer)
17+
IniRead, iniUpdate, %ini%,TTR-Tools, CheckUpdate
18+
IniRead, iniRep, %ini%,Trampoline, repeat
19+
IniRead, iniAFKMins, %ini%, AFK, afkMins
20+
download = % URLDownloadToVar("https://api.github.com/repos/thezoid/TTR-Tools/releases/latest")
21+
parsed := JSON.load(download)
22+
liveVer := parsed.tag_name
23+
downloadURL := "https://github.com/thezoid/TTR-Tools/releases/latest"
24+
liveVersionInt := formatVersion(liveVer)
25+
if(iniUpdate == "true")
26+
{
27+
if(versionInt < liveVersionInt)
28+
{
29+
MsgBox, 4, Update Found, TTR-Tools has found a more recent version released on GitHub. Compare- Current Version: %version%. Latest Version: %liveVer%. Download now?
30+
IfMsgBox Yes
31+
{
32+
Run, %downloadURL%
33+
}
34+
IfMsgBox No
35+
{
36+
MsgBox, 4, Update Found, Okay, TTR-Tools will not update. Remember this change?
37+
IfMsgBox Yes
38+
{
39+
IniWrite, false, %ini%, TTR-Tools, CheckUpdate
40+
MsgBox, 0, TTR-Tools, Won't check for updates again. Download new version manually to re-enable, or go into config file at %ini%.
41+
}
42+
}
43+
}
44+
}
45+
if(iniVersionInt < versionInt){
46+
FileInstall, default-conf.ini, %A_AppData%\TTR-Tools\config.ini,1
47+
}

default-conf.ini

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
[TTR-Tools]
2+
version=v1.0.3
3+
[Trampoline]
4+
repeat=0
5+
[AFK]
6+
afkMins=2

0 commit comments

Comments
 (0)