Re. the concurrency problem - I’ve seen it with Photos and Automator, and AppleScript and the QuickTime player. I’ve since gotten rid of these attempts, because they didn’t work, but what I remember was I created a Quick Action in Automator, using AppleScript inside it, that I could access from a context menu (right-click), so that I could select a series of jpegs in Finder, right-click, and add them to Photos. This worked if Photos was already up and running, but if it wasn’t, it took a bit for Photos to start up. Maybe I’d picked 10 photos to add. Only something like 3 would make it.
Automator has a specific widget for importing images into Photos, but it only works while Automator is running. It doesn’t take input from another widget in the workflow. You have to copy and paste the list of images you want to add into the Photos-importing widget (easy enough to do with copy/paste from Finder), and then run the workflow (laborious), and what I remember is it operates cognizant of this problem. The widget makes sure Photos is up and running, and then does the import, so everything works reliably. With what I tried with Automator/AppleScript, I tried putting in delays so that it would wait until Photos was up before doing the import, but Photos didn’t always take the same amount of time to come up. So, images were still getting dropped.
I eventually found it was more reliable to just select the images, and drag them to the Photos icon in the Dock. That always worked.
The problem with QuickTime player was annoying, because AppleScript seemed to make it easy to do things with QuickTime, since it had commands for talking directly to it. I was trying to bring up QT, and access its menu items to configure it the way I wanted. Sometimes that worked, but sometimes it didn’t. Again, it seemed to depend on whether I had QuickTime up and running or not, before running the script. I realized there were a couple ways to do this. One was “tell”-ing QuickTime directly to do them. The other way was to access menus indirectly, I think using SystemEvents, which works through Finder, as I recall. This turned out to be reliable; never had a problem with it, but the code is messy.
The most sophisticated thing I’ve done with AppleScript was to make the equivalent of something like Alfred. I wanted a way to type a query into a search bar for specific web apps. without bringing up the website, waiting for it to load, and typing it into its search bar. So, I had a menu I’d either hardcoded or configured through a resource file that the script would load (I forget), and display in a selection box, containing the different web apps it supported. I’d pick one, then it would bring up a text box allowing me to type my query. Based on the app I picked, it would format a URL for that app, and send it through my default web browser, which would show the result in a new tab. I was pretty happy with it. Then I found out about Alfred, and have been using that, instead. 