How programming helped me control my anxiety

David Kirsch
3 min readSep 28, 2020

All of us have dealt with anxiety at some point in our lives, from test-taking to relationships to our fears. Some people suffer from anxiety a lot more than others however. I have dealt with it since I was a child and it comes and goes in my adult life. There are things that can trigger my anxiety and one major trigger is the feeling of helplessness. The Covid-19 pandemic caused one of the biggest anxiety attacks I had in my adult life.

We as programmers have the opportunity to solve real-world issues. We notice a problem in the system, and build a solution that fixes it. That is the beauty of this field, we are the doctors of cyber-world.

When the pandemic began in NYC, we were seeing thousands of people a day test positive for Covid. Nervous of what would happen if I caught the virus, I made sure to stay in my studio apartment at all times, only going out once every week for a 30 min walk in a nearby empty park. My anxiety grew day-by-day when I tried to place delivery orders on Amazon only to find all the delivery slots were taken and there was never a schedule of when the new slots would open.

My anxiety became so bad that for multiple days/nights I could feel my heart racing and could not sleep. The unknowingness of the virus kept me from going to the grocery store in fear that I might catch it, and the lack of delivery slots on amazon, freshDirect, Shipt, and many others pushed my anxiety to an all time high. This is when I decided to come up with a way that would solve my anxiety and let me take control of my life.

I had played with AppleScript before just to do basic things like open programs, play music and such but never thought to use it for real-life things. After looking into the documentation on AppleScript along with other resources, I was able to build a program that would search Amazon every 20 seconds to look for an open delivery slot. Whenever I needed groceries, I would load everything I wanted in my shopping cart, go to the checkout page and run my program. The program would read the entire page and look for keywords, in this case it looked for “No doorstep delivery windows are available”. If it found this, it would reload the page again. It would loop this function till it could not find this on the page, at which point, I would have an alert sent to my phone as a text message and an audio notification on my computer notifying me that there was a found slot. At which point I would either run to my computer or open my phone and click on the found time slot and submit my order!

When I got this working, I felt a huge weight lifted off me and I felt like I had control again. I was able to take my skills and knowledge and apply it to some issue I was having and come up with a solution. This is why I love programming. We can come up with solutions to real-life problems with just our computer and our knowledge. I could have went to the doctors to get medication that would only put a bandaid over the real problem, or I could fix the problem myself so that I don’t have to rely on pills. I chose the latter.

Below is a copy of my code I have on my github account

source:

https://developer.apple.com/library/archive/documentation/AppleScript/Conceptual/AppleScriptLangGuide/introduction/ASLR_intro.html#//apple_ref/doc/uid/TP40000983-CH208-SW1

--

--

David Kirsch

Full Stack Software Engineer. Bachelor’s in Technology —Specializing in Software Development from NYCCT — CUNY. Flatiron School Graduate