Changing Font and spot color in Illustrator 10

1.I been trying to change the font to a text art item in Illustrator, I already do like the Reference Guide says

tell application "Adobe Illustrator 10"
	make new text art item in current document with properties {contents:"Hello World!", position:{200, 200}}
	set the size of the text of the result to 24
	set the font of the text of the result to " Times New Roman"
end tell

  1. I try to apply a new spot color swatch to my new text and the same thing, i have no the best results.
tell application "Adobe Illustrator 10"

	set docColorSpace to color space of document 1
	if (docColorSpace is CMYK) then
		set newSpotColor to {cyan:25.0, magenta:75.0, yellow:0.0, black:0.0}
	else
		set newSpotColor to {red:255.0, green:0.0, blue:25.0}
	end if

	make new spot in document 1 with properties �
		{name:"My Spot", color:newSpotColor, color type:spot color}
	make new text art item in current document with properties {contents:"Hello World!", position:{200, 200}}
	set the fill color of the text of the result to "My Spot"
	
end tell

i Use as the guide say

set the font of text of the result to font ""

But Nothing, it does not works

It’s not working because the property ‘fill color’ requires a specific class of data and you are trying to assign it a string (the name of your spot color). Instead try the following:

tell application "Adobe Illustrator 10"
	set doc to document 1
	set newSpotColor to {cyan:25.0, magenta:75.0, yellow:0.0, black:0.0}
	if exists spot "newSpot" of doc then
		set newSpot to spot "newSpot" of doc
	else
		set newSpot to make new spot in doc with properties {name:"newSpot", color:newSpotColor, color type:spot color}
	end if

	(* THE FOLLOWING LINE IS WHERE YOU DEFINE THE FILL COLOR *)
	set spotInfo to {class:spot color info, spot:newSpot, tint:100.0}

	set newText to make new text art item in doc with properties {contents:"Hello World!", position:{200, 200}}
	set fill color of (text of newText) to spotInfo
end tell

It is the right code that I need,
have you any idea for the change font code?

If you want to follow the ‘set fill color’ statement, you can use:

   set font of text of newText to "Font Name"

where “Font Name” is the name of the font you want to set the text to.

here is the code

tell application "Adobe Illustrator 10"
	set doc to document 1
	set newSpotColor to {cyan:25.0, magenta:75.0, yellow:0.0, black:0.0}
	if exists spot "newSpot" of doc then
		set newSpot to spot "newSpot" of doc
	else
		set newSpot to make new spot in doc with properties {name:"newSpot", color:newSpotColor, color type:spot color}
	end if
	
	(* THE FOLLOWING LINE IS WHERE YOU DEFINE THE FILL COLOR *)
	set spotInfo to {class:spot color info, spot:newSpot, tint:100.0}
	
	set newText to make new text art item in doc with properties {contents:"Old", position:{200, 200}}
	set fill color of (text of newText) to spotInfo
	set font of text of newText to "Arial"
end tell

And i try too:

tell application "Adobe Illustrator 10"
	set doc to document 1
	set newSpotColor to {cyan:25.0, magenta:75.0, yellow:0.0, black:0.0}
	if exists spot "newSpot" of doc then
		set newSpot to spot "newSpot" of doc
	else
		set newSpot to make new spot in doc with properties {name:"newSpot", color:newSpotColor, color type:spot color}
	end if
	
	(* THE FOLLOWING LINE IS WHERE YOU DEFINE THE FILL COLOR *)
	set spotInfo to {class:spot color info, spot:newSpot, tint:100.0}
	
	set newText to make new text art item in doc with properties {contents:"Old", position:{200, 200}}
	set fill color of (text of newText) to spotInfo
	set font of (text of newText) to "Arial"
end tell

:frowning: :frowning:

It must be a valid font name. Usually “Arial” is not the actual name of an Arial font. I have a few versions of Arial and the name for the common one is “ArialMT”. A good way to find out exactly what name Illustrator wants is to set up a dummy doc with one text art item with the text set to the font you want, then run this:

tell app "Adobe Illustrator 10" to return font of text of first text art item of document 1