Hey Dan, thanks for the quick response!
I tried the script you posted, but unfortunately it yields the same error message that mine did… that line four cannot be executed because null is not an object. I imagine that there’s something wrong with the way both of us are trying to access the text property of a layer, but I can’t seem to find clear documentation in the Scripting Guide on how to access a layer’s Source Text property.
What weirds me out is that although the TextDocument object is defined as storing a layer’s Source Text property, it has an attribute (text) which stores the Source Text. What’s not clear to me is whether you can change the (… .value) of TextDocument or if that’s superseded by (… .text)
There’s also the TextLayer object, which is a subclass of AVLayer and has its own properties (including Source Text).
Clearly I still have a lot to learn about AE Scripting. I can’t thank you enough for your help (and website) though!