Site Sponsor

Archive for Scripting

Great After Effects Scripts

As I take a chance to catch my breath after a bunch of big projects, I’ve been taking a look around to see what’s happening with other folks. While I was doing research I ran across the scripts, expressions and experiments at nabscripts.com. nabscripts is written in french so although I’ve noticed it in the past, it’s on my blogroll and nab is a regular poster at aenhancers, I haven’t dug into his (her?) site as much as I might normally.

Well, recently I ran across his collected scripts in english, and I must say they are a really nice set of scripts. I particularly like the auto orient camera script and createCylinder script. There are also a ton of utility scripts for making your every day life easier. The script collection section is also available in the original french. Nice work all around.

Comments (3)

Scripting Basics: pulling random values from within a defined range in After Effects

A common scripting requirement is to pull random values from within a defined range. For example, in the block dissolve transition the individual blocks of video are extracted from the video in a random order. Let’s revisit our float away video wall script and customize it to work in the same manner as a block dissolve but with a little more flair. We will scale the individual blocks up instead of just transitioning on and off.

Read the rest of this entry »

Comments

Script to automate rigging a camera in After Effects

final update July 15, 2006

Added a new Point of Interest expression instead of dealing with the Auto-Orient dialog as detailed in the comments.

second update July 14, 2006

Chris Prosser suggested a decent workaround of using app.executeCommand(app.findMenuCommandId(”Auto-Orient…”)) to auto-launch the Auto Orient dialog. Which in my opinion makes the script pretty usable, even with the slider range problem. Right now, I’m launching a dialog that reads “Auto Camera Rig” needs to have Auto-Orient set to “Off”, please set it in the following dialog and then immediately launching the Auto-Orient dialog. I’d be interested in feedback on whether I should leave the two dialog boxes for context or use a saveSetting() preference to give the user a Never Show Again option as well as Ok. Power users could always just comment out the alert line. Scripting UI’s are always difficult for me, I think I know how I’d handle it in a regular mac app, but I’m not so sure how to handle it here.

update July 14, 2006

Stu Maschwitz pointed out some deficiencies with the original version of this script and provided a sample project of a much better implementation of a rigged camera project. Unfortunately, there seem to be a couple of show stoppers for recreating his project via scripting and I’d love some feedback if anybody has worked through these issues, and if not I’ll send them off to aebugs@adobe.com. The first is the addCamera() method assumes a point of interest in its constructor. That seems to make the UI equivalent of layer:transform:Auto Orient:Off impossible. I’ve tried setting the property to Null, etc. with no success. Interestingly, there is a useful assistant to set the property. Secondly, I can’t seem to set the slider control range via scripting. I can set the value but not the range so this may be less of a show stopper than the first. I’ve uploaded the changes that reflect Stu’s sample project, so if you find running the script then turning Auto orient off (command-option 0, on the Mac..control-alt 0, windows? I don’t have a Windows box handy), and can live with the slider range limitation, then great. Send any fixes my way and I’ll incorporate them. I think I see why nobody took this one on .

I was doing a bit of research and ran across Kyle Sim’s request to automate his process of rigging an After Effects camera on aenhancers and the adobe forums. Seemed like a really useful script and as near as I can tell nobody has tackled it, so I decided to give it a shot.

Usage is really straight forward, copy the script to After Effects:Scripts and run it from the scripts menu with an active Comp selected. I’m not doing any layer name checking because I think it’s possible that you might want more than one camera and null, although we’d have to adjust the expressions accordingly.

When I run the script my effect window for the Mover Null looks like this and it does a great job of making the camera move really straight forward.

Null Effect Controls from automated camera rig script for After Effects

You’ll have to thank Kyle or whoever set up the original expressions for the idea, this just automates the creation of the rig.

Update 04.21.2007

Paul Tuersley kindly updated this script with some cool new features.

I've attached an update to your db_autoCameraRig script.
I've added a  check for AE8 which then automatically
turns of Auto-Orient.
I also  streamlined the bit that sets  the position / POI
values.

Here’s Paul’s new script, and I’ve left the original up as a legacy 1.0 version in case we get any problems out in the field.
JSX script With Paul’s Improvements
Original Source JSX script
Update 06.10.2007
Paul kindly sent me additonal updates to his modification of the script.
Paul writes…

I’ve tweaked how this version deals with the Auto-Orient issue, which
you may want to check out. In AE6.5 it puts up an alert to tell you
to turn Auto-Orient off, in AE7 it does the same and then opens the
Auto-Orient dialog and in AE8 it turns Auto-Orient off automatically.
I also added expressions to all the properties you shouldn’t alter,
effectively locking them.

Thanks Paul.

Paul’s lates modifications - JSX script in a zip archive

Comments (13)

How to make a “Float Away Video Wall” in After Effects via scripting

I was watching HBO a bit ago and noticed a fun promo where the playing video breaks into a grid and slowly floats away out of frame (Anybody familiar with the work know where I can find a link to a web video? update: 08-07-2006 Greg Grusby correctly pointed me to this page from Shilo which makes it clear that my script is just a tech demo <grin>.). Although I’m not a fan of duplicating a concept just to mimic it technically, I thought it might be fun to work through the steps necessary to pull off something similar via After Effects scripting.

Update July 12, 2006

Thanks to Jeff Almasol for the tips about Alpha Add and Null names in the comments below. I wasn’t aware of it, but it looks like his script rd_Slicer addressed a lot of this how-to without the float away expression in a really nice package. Jeff’s scripts and resources at redefinery are must see.

Read the rest of this entry »

Video Wall Make a Big Impression

Comments (9)

A line chart script for After Effects

the Line Chart script UI in After Effects

This one is a little rough around the edges, but I wanted to get it out there so I can get some feedback and feature requests from readers.

Read the rest of this entry »

Comments (2)

How to use a spreadsheet to generate Lower Thirds, Slates, Titles, etc. in After Effects

UPDATE 08.16.2007 Interim solution for AE CS3, see details at the end of this post.
I’ve been posting for a while about integrating databases into our workflow. A good database and workflow architecture can really maximize your productivity. But the bottom line is that most collaborative work gets done in a piecemeal fashion either by email, cut and paste or sending documents back and forth to clients and collaborators. I’m sure you’ve run into a situation where you find your self cutting and pasting between an Excel document into a text field while making Lower Thirds, Slates, Titles or other text-centric project. In this article I’ll explain a workflow to automate creating Lower Thirds in After Effects and I’ll follow up with an article on how to do the same thing in Final Cut Pro shortly.

Read the rest of this entry »

Comments (31)

Converting a Web Color to an RGB float array for After Effects

I’m writing a script that needs hexadecimal color input, sometimes referred to as a web color, converted to a value usable for a solid in After Effects. After Effects wants an array of RGB values in the range 0 to 1: [R, G, B]. Luckily Javascript supports bit-wise operators so the conversion is pretty straight forward. I used this function.

var hex = 'ffaadd';
var colors = hexToRGBArray(hex);

alert("red =" + colors[0] + ” green=” + colors[1] + ” blue=” + colors[2]);

function hexToRGBArray(hex){
	var rgb = parseInt(hex, 16);
	var red   = (rgb >>16) & 0xFF;
	var green = (rgb >>8) & 0xFF;
	var blue  = rgb & 0xFF;

	var colorArray = [red/255.0, green/255.0, blue/255.0];

	return colorArray;

}


Source for this script
Downloadable version of this script

Comments

Beginning javascript tutorial: Parsing a date from a sequenced jpeg filename

The other day I ran across another post at aenhancers.com. (aenhancers is a really great AE scripting forum by the way). The poster, Dan wrote:

I have shot thousands of stills
that I am now wanting to make
a time lapse movie out of. Each
still is named with the date and time
it was taken. For example
0507270505011.jpg would have been
taken yy/mm/dd/hh/mm/ss/(camera ID).
...
is there a way to parse the filename
to convert it into something more
legible? So 0507230004461.jpg would
translate into July 23, 2005 - 12:10 AM?...


The more I thought about it, this is exactly the kind of task I’m hoping to cover here at Creative Workflow Hacks. So in addition to posting a usable solution at aenhancers I decided to do a tutorial here with the problem solving steps involved. You know, teach a guy to fish and all.

I’m also going to try something new here. From the feedback I’m getting from users, the skill level and interest in DIY varies a lot. Some of you are hoping for beginners tutorials, some are looking for more advanced ideas and inspiration, and some of you are looking for solutions that are already thought through where you can download a bit of software, do your work and forget about it. So, I’m going to try labeling categories with beginner, intermediate, advanced and shrinkwrapped (although not that much software is actually shrinkwrapped anymore) depending on the skill level and the degree of involvement necessary to get the solution working. Send some feedback if you find it useful or not.

Back to our date parsing problem. Like almost all computer problems, the key here is to break down the big problem into a series of smaller problems. Read the rest of this entry »

Comments (2)

Moving toward reading FCP source timecode from imported Quicktimes in After Effects

A recent thread on aenhancers discussed reading source timecode from Quicktimes imported from Final Cut Pro captures in After Effects. Seems like a perfectly reasonable request, there could be a bunch of situations where this information would be useful in an After Effects project. Problem is, it doesn’t seem really easy to grab that data. When you view the timecode track in the imported quicktime, the timecode is in reference to the source Quicktime not the source tape from the capture.

Correction

Mark Burton posted on the thread mentioned above that actually the timecode is written to the Quicktime. He offered a link to Sebsky Tools as an example of an app using that info. I simply misread the Quicktime player info. There is still useful info from Final Cut we can access and I think the ideas in this article are interesting so I’m leaving it up with this correction. Thanks Mark.

At least until Apple decides to put that information into the captured Quicktime We’ll need to find a workaround way to read FCP info and that’s what I’m going to cover in this post.

Read the rest of this entry »

Comments (6)

Stupid Scripting Tricks: Import every Quicktime available

Here’s a fun one. Run this script and it will import every Quicktime on your hard drive or mounted server that After Effects understands. Stupidest hack ever, right? Well yeah, but there is some real gold in this line of the script

mdfind 'kMDItemKind == "QuickTime Movie"'

mdfind is the command line version of Apple’s spotlight technology. Combined with the new Quicktime metadata API and system.callSystem() there’s a lot for a hungry developer to chew on.

The script, osX 10.4(Tiger) and After Effects 7 only (I know, I know)

var myProject = app.project;

var osString = "mdfind 'kMDItemKind == \"QuickTime Movie\"' | wc -l" ;
var numberOfQTs = system.callSystem(osString);
//After Effects seems to choke when I feed it more than 41 items at a time, so let's use sed to give it 40 to chew on at a time
for(x=1; x < numberOfQTs; x = x + 40){
	var osString = "mdfind 'kMDItemKind == \"QuickTime Movie\"' | sed -n '" + x + ", " + ( x + 40) + "p'";
	//alert(osString);
	var systemCall = system.callSystem(osString);

	var movArray= systemCall.split("\\n");

	for(y=0; y < movArray.length; y++){
			try{
				var my_io = new ImportOptions(new File( movArray[y]));
				var myItem = myProject.importFile(my_io);
			}catch(e){
				//eat errors
			}
	}
}

And the downloadable version

importEveryQuicktime.jsx.zip

followup 5/4/2006 2:30P EST:

So, most folks working in motion graphics have a lot of quicktimes on their system and don’t necessarily want to take a long time to import all of them into an After Effects project as a proof of concept ( I told you this was a Stupid Scripting Trick). Therefore, here’s a version that imports the first 20 of them with head -n 20 to act as a proof of concept for you busy people .

Here ya go:

import20Quicktimes.jsx.zip

You’ll need to turn on Allow Scripts to Write Files and Access Network and turn off Enable JavaSript Debugger so we can eat the errors. As in anything that allows write access to your file system, be careful in experimenting with this script.

Comments