You can do this with live captions. No need for a script.
This is great— thank you! however you have to select all the image in order to generate the live caption. My file is about 320+ pages, any way to run live caption without having to select the files?