Setting font in Illustrator CS2

AS noob here!
I’m trying to create a little text-frame with some time-stamp info and positon it in a psuedo-slug area just off the artboard. So far so good, but I’ve been unable to figure out how to set the font and point size for this text frame.

A short code snippet or two showing how the font (and point size) is to be SET for a given text frame would be of great help. This is created early in the life of the file and most likely will be frame 1.

=Alan R.

Model: PowerPC G5
AppleScript: 1.10.6
Browser: Safari 417.9.3
Operating System: Mac OS X (10.4)

Hi

this is a section of a script i have it will mean nothing to you i guess but has most of the bits you may need to help with
your script.

tell application "Illustrator CS"
	activate
	set docref to make new document with properties {height:840, width:595}
	set thisdoc to current document
	set ruler origin of document 1 to {0.0, 0.0}
	set zoom of view 1 of document 1 to 1.3
	if not (exists swatch "Black" in current document) then
		make new color at beginning of current document with properties ¬
			{name:black, CMYK color info:{cyan:0, magenta:0, yellow:0, black:100}}
	end if
	make new character style in thisdoc with properties {name:"style1"}
	make new character style in thisdoc with properties {name:"style2"}
	set the size of character style "style1" of thisdoc to 10
	tell thisdoc
		set the fill color of character style "style1" of thisdoc to {class:CMYK color info, cyan:0, magenta:0, yellow:0, black:100}
	end tell
	set the text font of character style "style1" of thisdoc to text font "Helvetica"
	make new text frame in thisdoc with properties {name:"text1", position:{25, 800}, contents:((current date) as text) & return & return & "Job Number:" & myjobnumber & return & return & "Paul" & return}
	apply character style character style "style1" of thisdoc to text range of text frame "text1" of thisdoc
	
	set the size of character style "style2" of thisdoc to 12
	tell thisdoc
		set the fill color of character style "style2" of thisdoc to {class:CMYK color info, cyan:0, magenta:0, yellow:0, black:100}
		--set the text font of character style "style2" of thisDoc to text font "Helvetica"
		make new text frame in thisdoc with properties {name:"text2", position:{25, 350}, contents:thename}
		apply character style character style "style2" of thisdoc to text range of text frame "text2" of thisdoc
	end tell
end tell

Thanks pidge!

That is just the little ‘nudge’ I need. Most of what you have there IS looking familiar (OMG - is this AS thing starting to sink in??)

=Alan R.

Back again - Still need a little help. VERY VERY close but my font name SET is failing.

Below is my current version with a comment where it is failing.

TIA for any comments or help
=Alan R.

tell application "Adobe Illustrator"
	
	tell current document
		set docName to name
		set hgt to height + 25
		try
			-- Test for existing Timestamp text frame
			set tmp to contents of text frame "TStmp"
			set s1 to "File: " & docName
			set s2 to second paragraph of tmp -- Get Created on string
			set s3 to "Modified on: " & (current date)
			set contents of text frame "TStmp" to s1 & return & s2 & return & s3
		on error
			try
				make new character style with properties {name:"tsStyle"}
				set the fill color of character style "tsStyle" to {class:CMYK color info, cyan:0, magenta:0, yellow:0, black:100}
				set the size of character style "tsStyle" to 6
				set the name of text font of character style "tsStyle" to text font "Helvetica"
				-- The above line fails but rest of script works!
			end try
			make new text frame with properties {name:"TStmp", contents:"File: " & docName & return & "Created on: " & (current date)}
			apply character style character style "tsStyle" to text range of text frame "TStmp"
		end try
		set the position of text frame "TStmp" to {10, hgt}
	end tell
end tell

Hi Alan

Re jigged your script abit try this.

tell application "Illustrator CS"
	activate
	set docName to name of current document
	set thisdoc to current document
	set doch to height of thisdoc
	set docw to width of thisdoc
	set ruler origin of document 1 to {0.0, 0.0}
	make new character style in thisdoc with properties {name:"style1"}
	set the size of character style "style1" of thisdoc to 6
	tell thisdoc
		set the fill color of character style "style1" of thisdoc to {class:CMYK color info, cyan:0, magenta:0, yellow:0, black:100}
	end tell
	set the text font of character style "style1" of thisdoc to text font "Helvetica"
	make new text frame in thisdoc with properties {name:"TStmp", position:{10, doch + 25}, contents:"File: " & docName & return & "Created on: " & (current date)}
	apply character style character style "style1" of thisdoc to text range of text frame "TStmp" of thisdoc
end tell