Copy link to clipboard
Copied
I'm attempting to change the type on a text range with code (CEP) and am unable to do so.
The following is a screen shot of the layers in this file.
I attempt to select and change the text range like so (I don't get passed the selecting part):
var iDoc = app.activeDocument;
var custom1Only = iDoc.textFrames.getByName('Custom1Only');
alert(custom1Only.contents);
var custom1 = iDoc.textFrames.getByName('Custom1');
alert(custom1.contents);
I then get the error for 'Custom1'. it says "Error: No such element"
Any idea why this is happening? Strangely enough Custom1Only is accessible.
1 Correct answer
As @femkeblanco said, it may possible that the textframe content is "Custom1", but in real its name is empty. Try to give name to the textframe again and run your script.
Explore related tutorials & articles
Copy link to clipboard
Copied
Hi @OhmsG, I made a file to match yours and ran your exact code. It worked fine for me—I got both alerts. Try setting up again in another document or post your actual test document and someone might be able to get to the bottom of it.
Copy link to clipboard
Copied
Is the textFrame definitely named?
Copy link to clipboard
Copied
As @femkeblanco said, it may possible that the textframe content is "Custom1", but in real its name is empty. Try to give name to the textframe again and run your script.

