Yeah, I have some Python scripts that reflow selected passages of code for me using this approach. It always feels so weird when I’m using some OS that seemingly doesn’t support any sort of GUI scripting.
It’s worth noting that while you can simulate mouse clicks and key strokes within any app, some support a few direct scripting commands. For example, in Terminal, you don’t need a GUI script to open a new window and type in it to run some command. You can just issue an AppleScript command to tell app "Terminal" to do script "top"
or whatever. That’s because Terminal’s scripting library includes a do script
command.
For more on this, you can fire up Script Editor and go Open Dictionary. You will see a list of all apps with any sort of scripting support and be able to get documentation on what you can do with it.
I think from a free advice perspective, it’s worth talking to your local pharmacist? While not a substitute for doctor visits, my experience is that their advice on minor maladies is way more on-point than what I get from relatives, co-workers, etc. And they are super well-versed on the pitfalls of off-the-shelf remedies. Yet a lot people only approach them to pick up a prescription.