or create a photoshop action and do it just once in Photoshop. After that just batch script stuff inside Photoshop (file > automate > batch processing or something like that once you have your script recorded).
I guess you could do that with scripting or do in Photoshop manually. Just create new black bitmap that uses as alpha channel the inverted AO render (white = key). But honestly solid RGB layers are pretty common compositors, like reflection, light and or shadow maps they are usually used with blend modes in AE, PS or…
Set the AO layer as Normal blending mode at 100% opacity in Photoshop, then go to the Channels palette and CTRL+click any of the channels to make that into a selection. Invert the selection. Add this selection as a layer mask to a pure black solid colour layer (or dark blue, whatever colour you want your shadows). You can…