Huh ?

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

First off, Happy New Year to all.

I was wondering whether anyone could check out this short script for me. Its bizarre, and I can't tell whether its me or my machines - I have a bunch of somewhat flaky beta software on.
All it does is create two folders - 'comp' and 'footage' and loop through all the items in the project window and place them in the appropriate folder.
Unfortunately it always seems to leave one or more items hanging out in the project window and there seems to be no rhymn or reason to this.

clearOutput();

var newFolderF = app.project.items.addFolder("footage");
var newFolderC = app.project.items.addFolder("comps");

for(i = 1; i <= app.project.numItems; i++) {
if(app.project.item(i) instanceof FootageItem)
app.project.item(i).parentFolder = newFolderF;
if(app.project.item(i) instanceof CompItem)
app.project.item(i).parentFolder = newFolderC;
}

Thanks,
Stephen.
nab
Posts: 203
Joined: November 29th, 2005, 3:00 am
Location: Royan
Contact:

Hi slawes,
you could add a blank character to the folder names (" comps", " footages"), they should appear at the top of the project panel if items are sorted by Name.
You could also choose the "sort by Type" mode, or loop through the items until they've all been scanned...
slawes
Posts: 25
Joined: December 9th, 2006, 12:38 pm
Location: LA, California

Great, thanks, I'll try that.
The strange thing I have found is that if I replicate this function two or three times within the same script - to try and loop through the items a few times to pick up the stragglers - it doesn't have any effect. However, if I run the above script a number of times after it has finished it does pick up the stragglers.
Why would this be different ? A bug perhaps ?

Frankly, it should do it the first time since all it is doing is looping through every item in the project and deciding whether its a comp or footage.

Thanks,
Stephen.
slawes
Posts: 25
Joined: December 9th, 2006, 12:38 pm
Location: LA, California

Ok, so adding a space to each of " comp" and " footage" works which is great, but I still don't get why the original script doesn't work.

Thanks,
Stephen.
slawes
Posts: 25
Joined: December 9th, 2006, 12:38 pm
Location: LA, California

Nevermind, I've figured it out.

-Stephen.
Post Reply