Text size and animation properties

Find out why the . goes before the /

Moderator: Paul Tuersley

Post Reply
Shinjipierre
Posts: 36
Joined: December 4th, 2004, 10:10 am

December 4th, 2004, 1:10 pm

I'm scripting a Sub Station Alpha (subtitle script) -> after effects script, but I've got 2 main problems...

Problem 1

I don't know how I can change the size/color/font.

I've looked through the forum and found some things which didn't seem to work ^^.

Copying one of Impudent's script I came to that script. (a simple one ^^)

Code: Select all

{
	app.preferences.savePrefAsLong("Text Style Sheet", "Size", 15);
	app.preferences.saveToDisk();
	app.preferences.reload();
	app.project.activeItem.layers.addText("jambon");
	app.preferences.savePrefAsLong("Text Style Sheet", "Size", 35);
	app.preferences.saveToDisk();
	app.preferences.reload();
	app.project.activeItem.layers.addText("frites");
}
It doesn't seem to work, the size doesn't change when I execute the script.

Problem 2

I don't know how I can add an animation property.
I've aleady added a selector but I didn't manage to add the property.
The scripting guide doesn't explain anything about that...

By the way, if anyone could help me on these things.

Shinjipierre
User avatar
Disciple
Posts: 137
Joined: June 5th, 2004, 8:05 am
Location: Los Angeles, CA
Contact:

December 6th, 2004, 3:20 am

Pierre, about your second problem, do you mean adding keyframes for a specific property?
If so, check out my tutorial called "Add Slider/Expression to a comp"
http://aczet.free.fr/phpBB2/viewtopic.php?t=59

If that is not what you mean, could you clarify?

Alex
Shinjipierre
Posts: 36
Joined: December 4th, 2004, 10:10 am

December 6th, 2004, 4:38 am

Here are two screenshots of what I want to add.

http://naru.easynetonline.net/yaoithrow ... le%201.gif

http://naru.easynetonline.net/yaoithrow ... le%202.gif

The keys are already added with my script. (yeah, that's a karaoke effect ;)
Paul Tuersley
Posts: 704
Joined: June 5th, 2004, 7:59 am
Location: London, UK

January 4th, 2005, 7:53 pm

Problem 1 - how to change the text size/color/font.
I've tried this save pref thing and you're right, it doesn't seem to work. It does save the new Text Size value into the prefs, but it ignores this when creating a text layer and then overwrites it with the old value if you quit the app. Unfortunately not all prefs appear to play nicely with scripting, I'll send in a feature request.

Problem 2 - how to add a text animation property.
I can be a bit more help here. I've written this script which will create a report showing all the different types of properties on a selected layer (except the main transform properties which are handled differently), it's a great help when trying to figure this stuff out.

http://www.paul.tuersley.btinternet.co. ... .3.jsx.zip

And here's a little script that creates a new comp with a text layer, adds an Animator and then adds a Position property to it.

Code: Select all

{
	// create project if necessary
	var proj = app.project;
	if(!proj)
	proj = app.newProject();
	 
	var myItemCollection = app.project.items;
	var myComp = myItemCollection.addComp('Text Comp', 320, 240, 1, 10, 25);

	myText = myComp.layers.addText("Test");
	theAnimators = myText.property("ADBE Text Properties").property("ADBE Text Animators");
	myAnimator = theAnimators.addProperty("ADBE Text Animator");
	myPosition = myAnimator.property("ADBE Text Animator Properties").addProperty("ADBE Text Position");
}
Post Reply