frame sequence number

Find out why the . goes before the /

Moderator: Paul Tuersley

Post Reply
slawes
Posts: 25
Joined: December 9th, 2006, 12:38 pm
Location: LA, California

February 18th, 2007, 2:07 am

I've been writing a script to automatically construct a contact sheet from info through a custom gui, and everything renders ok, except that the render insists on adding the frame number to my file name.
So for instance, if I designate my file to be named VFX_C0110_contact.jpg, it always comes out like VFX_C0110_contact.jpg0001.
Is there anyway on not having the 0001 at the end ?

Thanks,
Stephen.
Paul Tuersley
Posts: 704
Joined: June 5th, 2004, 7:59 am
Location: London, UK

February 19th, 2007, 5:41 am

I couldn't find a way. But as long as your prefs allow scripts to write files, you can get the script to rename the file afterwards. For example:

Code: Select all

{
	// assumes a comp is the current activeItem and there is an output module template called "JPEG"
	
	var activeItem = app.project.activeItem;
	var renderQ = app.project.renderQueue;
	
	var theRender = renderQ.items.add(activeItem); 	// add comp to render queue
	var theOutputMod = theRender.outputModules[1];	// find output module
	
	theOutputMod.applyTemplate("JPEG");		// apply JPEG template	
	var theFolder = Folder.selectDialog();	// allow user to choose render folder
	
	// define a file object with the render path and filename
	theOutputMod.file = new File(theFolder.absoluteURI + "/VFX_C0110_contact.jpg");

	// render
	renderQ.render();		
		
	// define a file object with the render path and incorrect filename
	var theFile = new File(theFolder.absoluteURI + "/VFX_C0110_contact.jpg00001");

	// if the file exists and prefs allow it, rename the file
	if (theFile.exists && app.preferences.getPrefAsLong("Main Pref Section", "Pref_SCRIPTING_FILE_NETWORK_SECURITY"))
	{
		theFile.rename("VFX_C0110_contact.jpg");
	}	
}
slawes
Posts: 25
Joined: December 9th, 2006, 12:38 pm
Location: LA, California

February 19th, 2007, 10:19 am

Cool workaround Paul. I didn't know you could do system type ops through ae's java script. Sometimes it can be a real up-hill climb to find solutions to these problems.
Would you be kind enough to suggest a good java script book, I've been getting into scripting alot more recently and want to get some good reference. I only wish there was a good reference for ae scripting beyond this forum and the script guide though.

I've also had problems with setting a track matte. I've tried every possible order of commands but can't seem to get it working. I couldn't find any example stuff either. Here's what I've got -

(Layer3).trackMatteType.LUMA = true;
(Layer4).isTrackMatte;
(Layer3).hasTrackMatte;

Again, the scripting guide doesn't really shed much light on how to implement this.

Many thanks,
Stephen.
Paul Tuersley
Posts: 704
Joined: June 5th, 2004, 7:59 am
Location: London, UK

February 19th, 2007, 11:21 am

The AE scripting guide would really benefit from examples throughout. Here's what you're looking for:

Code: Select all

{
	// this script assumes you have a comp with two layers selected
	// it sets layer 2's track matte to Luma

	var activeItem = app.project.activeItem;
	activeItem.layer(2).trackMatteType = TrackMatteType.LUMA;
}
Alongside the AE scripting guide, you need the Bridge JavaScript Reference Guide, which includes the File, Folder and ScriptUI reference. This should be in the documentation folder on the AE install disk. I have an old copy of Javascript: The Definitive Guide for other reference, but you may want to try and find something slightly less hardcore.
slawes
Posts: 25
Joined: December 9th, 2006, 12:38 pm
Location: LA, California

February 19th, 2007, 11:51 am

Thanks Paul, you're a lifesaver, and thanks for the info too.

-stephen.
lilsmokie
Posts: 10
Joined: May 7th, 2008, 9:24 am

January 26th, 2011, 12:02 pm

Ugh this track matte thing gave me such a headache.
Thanks!
Post Reply