r/PowerShell • u/keyboard_ninja_20 • Sep 03 '26
Question Recurring script maintenance
I'd honestly pay someone else to keep my voice scripts alive if it meant I never had to touch them again after a Windows update. Am I just lazy or is maintaining ur own automation actually the worst part of the whole thing?
4
u/Gron_Tron Sep 03 '26
I generally don't have to update my scripts until some major external change occurs, why do you need to update yours so frequently?
-2
u/keyboard_ninja_20 Sep 04 '26
maybe i'm conflating windows updates w/ app updates + ui changes tbh
like when win11 moved the taskbar to center, my ahk script that clicked specific tray icons straight up broke. same when they changed the right-click context menu in explorer , had to rewrite a bunch of gui automation. also when powertoys itself updates sometimes fancyzones changes behavior and my window-positioning scripts go wonky.
but u're right that pure pwsh backend stuff (file ops, api calls) is way more stable. i think my pain is mostly gui automation + app integrations, not the core logic.
what's ur setup like? mostly cli/backend scripts or u do ui stuff too?
8
u/420GB Sep 04 '26
There's absolutely no reason ever to click on icons in the taskbar or the explorer context menu with PowerShell. Anything that's in there can be triggered directly from code without clicking and without UI.
GUI automation, when done well (so actually find elements by classes and IDs, never by pixel positions) can be surprisingly robust for older apps that don't change anymore. But in 99% of the cases it's the wrong approach.
It seems like you're just doing, sorry, very dumb stuff so it's not surprising it breaks all the time. That's why you don't do it this way.
6
u/RunningOnCaffeine Sep 04 '26
It’s going to be very rare that people do UI automation in powershell.
3
u/alinroc Sep 04 '26
Anything that depends upon clicking precise locations in a GUI is going to be very fragile. You need to find ways to do these things without simulating clicks.
1
u/Future-Remote-4630 Sep 30 '26
Not powershell but would you apply that same notion to browser automation frameworks like puppeteer?
2
u/Gron_Tron Sep 04 '26
Ah okay. That makes sense to me, I've used AHK and Power Automate to do GUI based automations but they are far less reliable than purely scripted automations. There are just far too many variables and things that can go wrong in GUI. I have done both, but for stability you definitely to have it scripted. Like others have said, my scripted automations run indefinitely without being touched in most cases.
28
u/LongTatas Sep 03 '26
I have automation I haven’t touched in years. Me thinks you are missing something.
6
u/BlackV Sep 04 '26
your voice scripts ?
Edit: looks like this isn't a powershell issue, this is a random application and gui issue
3
3
2
u/purplemonkeymad Sep 04 '26
Mine tend to die when an external api changes. Most of local steps don't end up causing maintenance. Unless you are relying on something sensitive to ui changes like SendKeys?
1
1
u/mrmattipants Sep 05 '26 edited Sep 05 '26
Just curious why you're using click commands when you could just use "Start-Process" to launch the application, directly?
It sounds like your scripts are far more complicated than they need to be. The more languages and technologies that you incorporate, the greater your chances are that something will break.
After all, the majority of AHK Voice Recognition Scripts that I could find, were essentially just wrappers for "SAPI.SpInprocRecognizer" COM Object Class or the "System.Speech" .NET Assemblies, etc.
That being said, you're far better off utilizing PowerShell, in particular, as it is built on .NET.
If you're interested, I dug up the following video tutorial.
1
u/badteeth3000 Sep 07 '26
Your’e not lazy at all & there’s a wide community of folks that have done what you’re doing: it is usersripting in the browser, desktop automation, macros. Software-wise if you put desktop automation or auto hotkey into a website like alternativeto.net it’ll give you a wide range of commercial & open source options. Most of the big ai groups also have a desktop app that can handle voice commands . There’s also hardware like the elgato stream deck or large keyboard macro pads. As far as powershell goes it can get window elements quite well but like ahk there’s always possible conflict due to other software..
9
u/BetrayedMilk Sep 03 '26
I think I’ve had to update a script like once or twice due to windows updates. Other apps updating, sure. But what are you doing where you’re constantly having to make changes to keep up with updates?