Creating a new document is as simple as invoking the following code:
var docRef = app.documents.add(2,4);
Next up, we can add a text layer:
var artLayerRef = docRef.artLayers.add(); artLayerRef.kind = LayerKind.TEXT;
and set the text of the text layer:
var textItemRef = artLayerRef.textItem; textItemRef.contents = “Hello world”;
Simple as that.
I had an idea that I might be able to use Photoshop for some mockup purposes using scripting. Not yet verified though.