Adobe Illustrator "Can't get text frame..."

Hi, It seem like I just can’t get that text frame, I always get the error message "can’t get text frame BANANE of layer 1 of document 1. I tried different appoaches (page item, text frame, text path) to be able to address commands to that text frame.

Anybody has an idea?

tell application "Adobe Illustrator"
	set MyDocument to current document
	
	tell MyDocument
		--make new layer with properties {name:"Dimensions"}
		
		set DimensionColor to color of swatch "Artios_Dimensions and text"
		set TrimSize to color of swatch "Artios_Cut"
		set BleedColor to color of swatch "Artios_Outside bleed"
		set ScoreColor to color of swatch "Artios_Crease"
		
		tell layer "Layer 1"
			set FrontPanelText to text frame "BANANE"
			tell FrontPanelText to convert to paths
		end tell

Hi. The code is workable. Are you sure there is a text frame with that name?

Yes, I tried with different text frames to make sure that wasn’t the problem. With wich version of Illustrator did you test it? I’m working with CC 2019 on Mac OS Sierra.

Thanks

That part is fine, it found the “Layer 1”

What would return :

tell application "Adobe Illustrator"
	set MyDocument to current document
	
	tell MyDocument
		--make new layer with properties {name:"Dimensions"}
		
		set DimensionColor to color of swatch "Artios_Dimensions and text"
		set TrimSize to color of swatch "Artios_Cut"
		set BleedColor to color of swatch "Artios_Outside bleed"
		set ScoreColor to color of swatch "Artios_Crease"
		
		log (name of every layer)
		tell layer "Layer 1"
			(*
			set FrontPanelText to text frame "BANANE"
			tell FrontPanelText to convert to paths
			*)
			name of every text frame
		end tell
	end tell
end tell

Yvan KOENIG running High Sierra 10.13.6 in French (VALLAURIS, France) lundi 6 mai 2019 11:21:41

(name of every layer of document 1)
get name of every text frame of layer “Layer 1” of document 1
→ {“”, “”, “”, “”, “”, “”, “”, “”}
end tell
Result:
{“”, “”, “”, “”, “”, “”, “”, “”}

I don’t know why it returned only commas… :expressionless:

That result isn’t returning commas; those are all empty text items—meaning there are no assigned names, as I indicated may be the possibility. A name has to be assigned to an object. Since you asked, I tested in CS3, but there are rarely changes in basic functionality.

So how can I point that object if it doesn’t have a name?

I tried before posting here, to search for the text frame by its contents but without any positive result.

You may get the contents by replacing :
name of every text frame
by
contents of every text frame.

You will get something like {“azerty”, “banana”, potatoes", “computers”}

Then, try:
set myTextFrame to first text frame whose contents is “banana” # edit to fit your needs.

Yvan KOENIG running High Sierra 10.13.6 in French (VALLAURIS, France) lundi 6 mai 2019 17:22:21

That worked perfectly :slight_smile:

Thanks a lot!