Skip to content

Commit 73aa392

Browse files
Merge pull request #11 from buttonpushertv/deleting-apps-from-settings
Deleting apps from settings
2 parents a87a742 + 83c767b commit 73aa392

File tree

3 files changed

+152
-6
lines changed

3 files changed

+152
-6
lines changed

BPTV-LAUNCHER.ahk

Lines changed: 77 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -114,12 +114,12 @@ Gui, Show, w%guiWidth% h%guiHeight%
114114

115115
;timer code section here
116116
;the timeout period is stored in settings.ini - under the [Settings] section as milliseconds - other values designated in above GUI code
117-
118-
;this code creates and upadtes the timer text & progress bar
117+
launcherTimeoutSleep := 1000
118+
;this code creates and updates the timer text & progress bar
119119
loop, %timeoutSegments%
120120
{
121121
GuiControl, , timeoutTextProgress, %timeoutRemaining%
122-
sleep, 1000
122+
sleep, %launcherTimeoutSleep%
123123
GuiControl, , timeoutProgress, +1
124124
timeoutRemaining := (timeoutSegments - A_Index)
125125
}
@@ -214,7 +214,80 @@ reload
214214
return
215215

216216
ButtonDeleteApp:
217-
MsgBox Not implemented yet. Edit the settings.ini file to remove items for now.
217+
launcherTimeoutSleep := 10000
218+
delTimeoutRemain := (timeoutRemaining * 10)
219+
delAppGUIH := 40
220+
appSectionKeys := round(section3_keys / 3)
221+
delAppGUIH += (appSectionKeys * 60)
222+
delAppGUIW := 580
223+
delAppLVH := (delAppGUIH - 60)
224+
delAppLVW := 560
225+
226+
Gui, DelApp:New, , Delete an App
227+
Gui, DelApp:Font, S12 CDefault, Franklin Gothic Medium
228+
Gui, DelApp:Add, Text, x10 y10 , Double-click the app you would like to remove below:
229+
Gui, DelApp:Font, S9 CDefault, Franklin Gothic Medium
230+
Gui, DelApp:Add, Text, x10 y30 , (You have about %delTimeoutRemain% seconds to make a choice.)
231+
Gui, DelApp:Font, S12 CDefault, Franklin Gothic Medium
232+
Gui, DelApp:Add, ListView, r%appSectionKeys% w%delAppLVW% h%delAppLVH% gdelListView, #|App|Enabled?
233+
234+
loop, %appSectionKeys%
235+
{
236+
LV_Add(,A_Index, Apps_nameApp%A_Index%, Apps_loadApp%A_Index% )
237+
}
238+
LV_ModifyCol(2)
239+
Gui, DelApp:Show, w580 h%delAppGUIH%
240+
241+
delListView:
242+
if (A_GuiEvent = "DoubleClick")
243+
{
244+
LV_GetText(RowText, A_EventInfo)
245+
appToDel := % Apps_nameApp%A_EventInfo% ; Get the text from the row's first field.
246+
MsgBox, 36, Delete this App?, Is this the app you want to delete?`n#%A_EventInfo%: %appToDel%
247+
IfMsgBox, No
248+
goto delAppNo
249+
IfMsgBox, Yes
250+
newNumberOfKeySets := (section3_keys - 3)
251+
currentAltCounter := 1
252+
Loop, %appSectionKeys%
253+
{
254+
If (A_Index = A_EventInfo) {
255+
Continue
256+
}
257+
tempApps_loadApp%currentAltCounter% := % Apps_loadApp%A_Index%
258+
tempApps_nameApp%currentAltCounter% := % Apps_nameApp%A_Index%
259+
tempApps_pathApp%currentAltCounter% := % Apps_pathApp%A_Index%
260+
currentNameValue := % tempApps_nameApp%currentAltCounter%
261+
currentPathValue := % tempApps_pathApp%currentAltCounter%
262+
currentLoadValue := % tempApps_loadApp%currentAltCounter%
263+
currentAltCounter += 1
264+
}
265+
Loop, %section2_keys%
266+
{
267+
Apps_loadApp%A_Index% := % tempApps_loadApp%A_Index%
268+
Apps_nameApp%A_Index% := % tempApps_nameApp%A_Index%
269+
Apps_pathApp%A_Index% := % tempApps_pathApp%A_Index%
270+
}
271+
Apps_loadApp%appSectionKeys% := 0
272+
Apps_nameApp%appSectionKeys% :=
273+
Apps_pathApp%appSectionKeys% :=
274+
IniDelete, %inifile%, Apps, loadApp%appSectionKeys%
275+
IniDelete, %inifile%, Apps, nameApp%appSectionKeys%
276+
IniDelete, %inifile%, Apps, pathApp%appSectionKeys%
277+
appSectionKeys -= 1
278+
Loop, %appSectionKeys%
279+
{
280+
currentLoadValue := % Apps_loadApp%A_Index%
281+
currentNameValue := % Apps_nameApp%A_Index%
282+
currentPathValue := % Apps_pathApp%A_Index%
283+
IniWrite, %currentLoadValue%, %inifile%, Apps, loadApp%A_Index%
284+
IniWrite, %currentNameValue%, %inifile%, Apps, nameApp%A_Index%
285+
IniWrite, %currentPathValue%, %inifile%, Apps, pathApp%A_Index%
286+
}
287+
delAppNo:
288+
Gui, DelApp:Destroy
289+
reload
290+
}
218291
return
219292

220293
ButtonChangeTimeout:

MASTER-FUNCTIONS.ahk

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -95,7 +95,7 @@ rootFolder=
9595
), settings.ini
9696
FileAppend,
9797
(
98-
98+
9999
timeoutPeriod=15000
100100
splashScreenTimeout=4000
101101
CapsLockToggleTimeoutThreshold=4

MASTER-SETTINGS.ahk

Lines changed: 74 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -107,11 +107,13 @@ loop, %section2_keys%
107107

108108
Gui, Font, S12 CDefault, Franklin Gothic Medium
109109
Gui, Add, Button, x30 y%buttonStartingY% w100 h30, Add Script
110+
Gui, Add, Button, x150 y%buttonStartingY% w100 h30, Delete Script
111+
;Gui, Add, Button, x275 y%buttonStartingY% w100 h30, Variables ; Uncomment if you wish to have a button to show Variables assigned by the script
110112
Gui, Add, Button, x400 y%buttonStartingY% w100 h30, Cancel
111113
Gui, Add, Button, x520 yp w100 h30, SAVE
112114
Gui, Font, S10 CDefault, Franklin Gothic Medium
113115
Gui, Add, Text, x30 yp+40 w650, Clicking 'SAVE' will save the settings above and reload MASTER-SCRIPT.ahk and the checked scripts above.
114-
;Gui, Add, Button, x400 yp+32 w220 h20, Variables ; Uncomment if you wish to have a button to show Variables assigned by the script
116+
115117
Gui, Show, w%guiWidth% h%guiHeight%
116118
return
117119

@@ -142,6 +144,77 @@ INI_Save(inifile)
142144
reload
143145
return
144146

147+
ButtonDeleteScript:
148+
scriptSectionKeys := round(section2_keys / 3)
149+
delScriptGUIH := (scriptSectionKeys * 40)
150+
delScriptGUIW := 580
151+
delScriptLVH := (delScriptGUIH - 40)
152+
delScriptLVW := 560
153+
154+
Gui, DelScript:New, , Delete a Script
155+
Gui, DelScript:Font, S12 CDefault, Franklin Gothic Medium
156+
Gui, DelScript:Add, Text, , Double-click the script you would like to remove below:
157+
Gui, DelScript:Add, ListView, r%scriptSectionKeys% w%delScriptLVW% h%delScriptLVH% gdelListView, #|Script|Enabled?
158+
159+
loop, %scriptSectionKeys%
160+
{
161+
LV_Add(,A_Index, Scripts_nameScript%A_Index%, Scripts_loadScript%A_Index% )
162+
}
163+
LV_ModifyCol(2)
164+
Gui, DelScript:Show, w580 h%delScriptGUIH%
165+
166+
delListView:
167+
if (A_GuiEvent = "DoubleClick")
168+
{
169+
LV_GetText(RowText, A_EventInfo)
170+
scriptToDel := % Scripts_nameScript%A_EventInfo% ; Get the text from the row's first field.
171+
MsgBox, 36, Delete this Script?, Is this the script you want to delete?`n#%A_EventInfo%: %scriptToDel%
172+
IfMsgBox, No
173+
goto delScriptNo
174+
IfMsgBox, Yes
175+
newNumberOfKeySets := (section2_keys - 3)
176+
currentAltCounter := 1
177+
Loop, %scriptSectionKeys%
178+
{
179+
If (A_Index = A_EventInfo) {
180+
Continue
181+
}
182+
tempScripts_loadScript%currentAltCounter% := % Scripts_loadScript%A_Index%
183+
tempScripts_nameScript%currentAltCounter% := % Scripts_nameScript%A_Index%
184+
tempScripts_pathScript%currentAltCounter% := % Scripts_pathScript%A_Index%
185+
currentNameValue := % tempScripts_nameScript%currentAltCounter%
186+
currentPathValue := % tempScripts_pathScript%currentAltCounter%
187+
currentLoadValue := % tempScripts_loadScript%currentAltCounter%
188+
currentAltCounter += 1
189+
}
190+
Loop, %section2_keys%
191+
{
192+
Scripts_loadScript%A_Index% := % tempScripts_loadScript%A_Index%
193+
Scripts_nameScript%A_Index% := % tempScripts_nameScript%A_Index%
194+
Scripts_pathScript%A_Index% := % tempScripts_pathScript%A_Index%
195+
}
196+
Scripts_loadScript%scriptSectionKeys% := 0
197+
Scripts_nameScript%scriptSectionKeys% :=
198+
Scripts_pathScript%scriptSectionKeys% :=
199+
IniDelete, %inifile%, Scripts, loadScript%scriptSectionKeys%
200+
IniDelete, %inifile%, Scripts, nameScript%scriptSectionKeys%
201+
IniDelete, %inifile%, Scripts, pathScript%scriptSectionKeys%
202+
scriptSectionKeys -= 1
203+
Loop, %scriptSectionKeys%
204+
{
205+
currentLoadValue := % Scripts_loadScript%A_Index%
206+
currentNameValue := % Scripts_nameScript%A_Index%
207+
currentPathValue := % Scripts_pathScript%A_Index%
208+
IniWrite, %currentLoadValue%, %inifile%, Scripts, loadScript%A_Index%
209+
IniWrite, %currentNameValue%, %inifile%, Scripts, nameScript%A_Index%
210+
IniWrite, %currentPathValue%, %inifile%, Scripts, pathScript%A_Index%
211+
}
212+
delScriptNo:
213+
Gui, DelScript:Destroy
214+
reload
215+
}
216+
return
217+
145218
ButtonSAVE:
146219
Gui, Submit
147220
;Setting the location if it got changed

0 commit comments

Comments
 (0)