"Quick Export as PNG" not recorded as an action

This is a question dealing with file I/O.

I wish to select a layer, and then export it as PNG via “Quick Export as PNG.” However, such behavior is not recorded by Alchemist, nor does such a thing appear in the command history window. How do I script such behavior? Adobe’s UXP documents for “export” yield no results.

(I would also like to learn how to import multiple files and have them show up as layers, but I don’t know how similar the knowledge would be to do that. I can get a script to read the contents of a folder, but not actually import said contents.)

I’m mainly asking because I attempted to do something similar to what was attempted here: Export Layers to file individually but it looks like that thread died without a resolution. That particular script has an action descriptor, but my attempts to get anything to happen with that via batchPlay() have been fruitless, so I figured a more manual approach could also work.

I have seen various File I/O examples in the UXP docs (writing to txt or tsv, mainly), but I haven’t found anything for exporting to certain formats, or importing as layers.