So I read about the PID output, and it dawned on me that instead of closing 20ish startup apps when I want to play nioh on my $250, 2016, HP prodesk (I wont be playing anything more intensive, I assure you) I could simply remove all the programs from startup, and instead place a script in there that calls them.
But of course, I couldnt just do it the easy way. Im a coder, so I will settle for nothing less than NOT having to update that script every time I find a dinky new program. So....functions and vars and %a_index% and file appends. Would I rearn anything if I just wrote 7 lines of boring? Nope.
And im happy with it, I didnt get ANY help outside the handbook, and really had to think outside the box with what I DID know could work. So here it is. Either a cool new timesaver, or a decent Idea for you to perfect. But if youre that 2nd guy, I really just want to know where I could have gone better. I learned a lot about variable assignments using other variables and all that, but I cant imagine this is optimized.
I had it as winwait, but Im not sure if circle dock counts as a window and I was tired of guessing. UIt crashes 1/5 of the time anyway. Not to mention I want it so I dont have to edit...getting a title out of a variable? Nahh
Code: Select all
StartupApps_Run(){
Settitlematchmode, 2
PIDWin1 = NonExistant_File
PIDWin2 = NonExistant_File
PIDWin3 = NonExistant_File
PIDWin4 = NonExistant_File
PIDWin4 = NonExistant_File
PIDWin5 = NonExistant_File
PIDWin6 = NonExistant_File
PIDWin7 = NonExistant_File
PIDWin8 = NonExistant_File
PIDWin9 = NonExistant_File
1 = "Circledock"
2 = ClipboardHelpAndSpell
If 2 =
{
Loopcount = 1
Goto Loop
}
3 = NiftyWindows
If 3=
{
Loopcount = 2
Goto Loop
}
4 = Picpick
If 4 =
{
Loopcount = 3
Goto Loop
}
5 = Quicklinks
If 5 =
{
Loopcount = 4
Goto Loop
}
6 = Rainmeter - Light
If 6 =
{
Loopcount =5
Goto Loop
}
7 = Winlaunch
If 7 =
{
Loopcount = 6
Goto Loop
}
8 =
If 8 =
{
Loopcount = 7
Goto Loop
}
9 =
If 9 =
{
Loopcount = 8
Goto Loop
}
Loop:
loop, %loopcount%
{
Run := %a_index%
Run, %run%.lnk,C:\[DATA] All Files\[S] Startup Programs, min, %pid%%a_index%
sleep 15000
}
Results:
PIDRecord =
(
1 %PIDWin1%
2 %PIDWin2%
3 %PIDWin3%
4 %PIDWin4%
5 %PIDWin4%
6 %PIDWin5%
7 %PIDWin6%
8 %PIDWin7%
9 %PIDWin8%
0 %PIDWin9%
)
PIDWin1 = %pid1%
PIDWin2 = %pid2%
PIDWin3 = %pid3%
PIDWin4 = %pid4%
PIDWin5 = %pid5%
PIDWin6 = %pid6%
PIDWin7 = %pid7%
PIDWin8 = %pid8%
PIDWin9 = %pid9%
PIDWin0 = %pid0%
Fileappend, %PIDRecord%, C:\[DATA] All Files\[S] Startup Programs\Current Session PIDs.txt
Return
}
StartupApps_Run()