How you you join two strings with different fonts together?
var srcDoc = app.activeDocument; var artLayerRef = srcDoc.artLayers.add() artLayerRef.kind = LayerKind.TEXT; textItemRef = artLayerRef.textItem; textItemRef.size = 18; textItemRef.color = app.foregroundColor; textItemRef.font = "ArialMT"; textItemRef.contents = "Hello"; textItemRef.font = "Arial-BoldMT"; textItemRef.contents += " world!";
The above script puts the usual Hello world in Arial bold onto a new layer; but I was hoping it would write "Hello world!" (the difference being the second word is in bold). Is it possible to do this, and can anyone show me where I'm going wrong?
In DOM this is not possible so far, in your example textItemRef.font can only be one thing.
You need to use Action Manager code (as recorded with ScriptingListener.plugin).