Finally used AI to solve a real problem
What can I say? Despite seeing lots of things that AI can do, I hadn't really found a use for my personal use case. Until today!
I have a Elgato Stream Deck which is connected to my Mac. It works well... most of the time. However, occasionally, the Philip Hue plugin would hang and the only solution would be to quit the Elgato StreamDeck app and relaunch the app. I wanted to program one of the keys on the Elgato StreamDeck itself to quit and relaunch the app.
This sounds simple enough so I decided to use Apple Shortcuts and run the shortcut from the Streamdeck. This partly worked. Partly because, it executed the first part, which is quitting the app but did not relaunch it. This greatly annoyed me, as now, the Streamdeck is completely useless as opposed partially useless where only the Philip Hue buttons weren't working.
Anyway, I decided to ask Google Gemini:

Impressively, Google Gemini explained that sometimes the script can cut off mid execution which is what was happening in my case. The solution provided also made sure that the script did not cut off mid-day.
Anyway, as advised, I went with Method 1 and created the following shortcut:

The relevant code:
osascript -e 'quit app "Elgato Stream Deck"'
sleep 2
open -a "Elgato Stream Deck"
I then assign a button to run this Apple Shortcut from the Streamdeck and it worked flawlessly.
I must say, kinda impressed how easy this was. I am warming up to AI. At least for these specific use cases.