Skip to content

Commit 1a65842

Browse files
Merge pull request #12 from buttonpushertv/sorting-in-settings
Sorting in settings
2 parents 01bb4bc + 3df776a commit 1a65842

File tree

2 files changed

+394
-107
lines changed

2 files changed

+394
-107
lines changed

BPTV-LAUNCHER.ahk

Lines changed: 24 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -40,6 +40,16 @@ inifile = settings.ini
4040
INI_Init(inifile)
4141
INI_Load(inifile)
4242

43+
; this little section detects if the MASTER-SCRIPT.ahk is already running. That would be a sign that this launcher may have already been run. Since we don't usually want to run this launcher a second time (while the apps it launches are already running) we will set the timeout period to something very high so you have time to interact with the GUI and not have it quickly launch everything over again.
44+
SetTitleMatchMode, 2
45+
DetectHiddenWindows, On
46+
if WinExist("MASTER-SCRIPT.ahk") {
47+
Settings_timeoutPeriod := 9000000
48+
timeoutSegments := Round(Settings_timeoutPeriod / 1000)
49+
Tooltip, MASTER-SCRIPT.ahk IS ALREADY RUNNING.`nThe timeout is set to %timeoutSegments% seconds temporarily.`nQuit all checked apps `& scripts to reset timeout period.
50+
RemoveTooltip(4000)
51+
}
52+
4353
;Creating the Main GUI for the app - the bit that loads inititally when run
4454
;setting width variables
4555
guiWidth := 560
@@ -55,7 +65,7 @@ currentSystemLocation = % Location_systemLocation%Location_currentSystemLocation
5565
Gui, Font, S10 CDefault, Franklin Gothic Medium
5666
Gui, Add, Text, x20 y10 , Current Selected System Location: %currentSystemLocation%
5767
Gui, Font, S8 CDefault, Franklin Gothic Medium
58-
Gui, Add, Text, xp yp+15, (This can be changed in MASTER-SETTINGS.AHK)
68+
Gui, Add, Text, xp yp+15, (This can be changed via MASTER-SETTINGS.AHK - see button below)
5969
Gui, Font, S12 CDefault, Franklin Gothic Medium
6070

6171
;Section 2 - Scripts To Run
@@ -92,10 +102,12 @@ loop, %section3_keys%
92102
}
93103
Gui, Font, S8 CDefault, Franklin Gothic Medium
94104
Gui, Font, S12 CDefault, Franklin Gothic Medium
95-
Gui, Add, Button, x10 y%buttonStartingY% w100 h50, &Add App
96-
Gui, Add, Button, xp+110 yp w100 h50, &Delete App
97-
Gui, Add, Button, xp+110 yp w100 h50, &Edit`nsettings.ini
98-
Gui, Add, Button, xp+110 yp w100 h50, Change &Timeout
105+
Gui, Add, Button, x10 y%buttonStartingY% w80 h50, &Add App
106+
Gui, Add, Button, xp+90 yp w80 h50, &Delete App
107+
Gui, Font, S10 CDefault, Franklin Gothic Medium
108+
Gui, Add, Button, xp+90 yp w120 h50, &Launch MASTER-SETTINGS
109+
Gui, Font, S12 CDefault, Franklin Gothic Medium
110+
Gui, Add, Button, xp+130 yp w100 h50, Change &Timeout
99111
Gui, Add, Button, xp+110 yp w100 h50, &Save Changes
100112
timeoutSegments := Round(Settings_timeoutPeriod / 1000)
101113
timeoutText := "Launching Apps in " . timeoutSegments . " seconds. Launching in: Press ESC to Cancel."
@@ -110,11 +122,10 @@ Gui, Add, Button, Default x10 yp+30 w%guiElementWidth% h30, Launch Apps &Now
110122
;Gui, Add, Button, x10 yp+40 w430 h30, Variables
111123
Gui, Show, w%guiWidth% h%guiHeight%
112124

113-
114-
115125
;timer code section here
116126
;the timeout period is stored in settings.ini - under the [Settings] section as milliseconds - other values designated in above GUI code
117127
launcherTimeoutSleep := 1000
128+
118129
;this code creates and updates the timer text & progress bar
119130
loop, %timeoutSegments%
120131
{
@@ -126,6 +137,7 @@ loop, %timeoutSegments%
126137
goto launchApps
127138
return
128139

140+
129141
launchApps:
130142
loop, %section3_keys%
131143
{
@@ -191,6 +203,7 @@ ExitApp
191203
return
192204

193205
ButtonAddApp:
206+
launcherTimeoutSleep := 10000
194207
InputBox, newAppNameValue, Name or Description, Enter a Name or Description for the new app.
195208
InputBox, newAppPathValue, File Path, Enter the full path to the new app.`n(include path relative to %A_ScriptName%`nwhich is located in %A_ScriptDir%)
196209
if (!newAppPathValue) {
@@ -291,17 +304,16 @@ if (A_GuiEvent = "DoubleClick")
291304
return
292305

293306
ButtonChangeTimeout:
294-
InputBox, OutputVar, Change Timeout Delay, Set the amount of time to wait before launching checked apps.`n`n(Enter time in milliseconds. 6 seconds would be 6000ms, etc.))
307+
InputBox, OutputVar, Change Timeout Delay, Set the amount of time to wait before launching checked apps.`n`n(Enter time in milliseconds. 6 seconds would be 6000ms, etc.)),,,,,,,%Settings_timeoutPeriod%
295308
if OutputVar= ;IF NONE IS SELECTED , RETURN
296309
return
297310
Settings_timeoutPeriod := OutputVar
298311
INI_Save(inifile)
299312
reload
300313
return
301314

302-
ButtonEditsettings.ini:
303-
MsgBox, 262449, WARNING, You are opening the 'settings.ini' file in a text editor!`n`nThis file controls all aspects of how this set of scripts operates.`n`nPlease be very careful in here.`n`nIf you are going in to remove Apps or Scripts`, be sure to update the numbers after any items you delete (loadscript1, enableApp3, etc). Stuff will break if you don't.`n`nCANCEL to turn back...`n`nAfter exiting the text editor, this script will reload with your changes.
304-
RunWait, notepad.exe settings.ini, %A_ScriptDir%, Max
305-
Reload
315+
ButtonLaunchMaster-Settings:
316+
Run, %A_ScriptDir%\MASTER-SETTINGS.AHK ; runs the settings configuration script for the whole suite.
317+
ExitApp
306318
return
307319
;===== FUNCTIONS ===============================================================================

0 commit comments

Comments
 (0)