Setting the active, working composition

Find out why the . goes before the /

Moderator: Paul Tuersley

Post Reply
Darkmoon_UK
Posts: 62
Joined: September 5th, 2006, 3:45 am
Location: Chiswick, London, UK
Contact:

November 8th, 2006, 4:34 am

Hi,

I am currently writing a script that requires some specific 'processing' comps in the project to work.

The approach I am taking is, when the script runs, these comps will automatically be imported from an external project file to the current project. The active comp will then be inserted in the correct layer position in these processing comps. So far so good;

The problem I have is, I would then like the processing comp, with the 'current' comp inserted into it, to be made the foremost, active comp ready for further user input.

app.project.activeItem() is the read-only equivalent of what I want to do.
app.project.showWindow() comes close but only affects the project window.

Does anyone know how I might bring a specific comp to the fore by script, for working with?

- Chris
ajk48n
Posts: 20
Joined: January 17th, 2007, 3:02 pm

February 20th, 2007, 10:58 am

I have also been looking for an answer to this. Does anyone have any ideas?

Thanks in advance
byronnash
Posts: 321
Joined: July 7th, 2004, 2:30 pm
Location: Charlotte, NC
Contact:

September 28th, 2010, 1:59 pm

Bump.
Is this not possible?
Paul Tuersley
Posts: 704
Joined: June 5th, 2004, 7:59 am
Location: London, UK

September 29th, 2010, 6:29 am

No, sadly it's not possible. I think the only panels you can open / push to the front are the project and render queue panels. It would be useful if you could. Ideally, scripts would be able to "reveal" anything from a comp down to a property on a layer.
https://www.adobe.com/cfusion/mmform/in ... e=wishform
byronnash
Posts: 321
Joined: July 7th, 2004, 2:30 pm
Location: Charlotte, NC
Contact:

September 29th, 2010, 11:08 am

Lloyd pointed me to this workaround. It seems to be working my my particular script.

Code: Select all

function openCompPanel(thisComp)
{
// remember the original work area duration
var duration = thisComp.workAreaDuration;

// temporarily set the work area to 2 frames
// I know, I should use the comp fps to calculate it,
// but I only work in NTSC 30 fps.
// Anything less than 2 frames makes AE barf
thisComp.workAreaDuration = 0.06;

// make a 2 frame ram preview which forces the comp window to open
// I don't know the first and last arguments, and they may not want
// strings, but this works for me. The second argument is a scaling
// factor for the viewport. Use 0.5 for 50%, etc.
thisComp.ramPreviewTest("",1,"");

// Play nice and put things back the way they were
thisComp.workAreaDuration = duration;
}
Original thread http://forums.creativecow.net/thread/227/10710
Darkmoon_UK
Posts: 62
Joined: September 5th, 2006, 3:45 am
Location: Chiswick, London, UK
Contact:

September 29th, 2010, 2:31 pm

...ZOMFG! Just the kind of hacky workaround we've all been waiting for... amazing, thanks Byronnash!
nab
Posts: 203
Joined: November 29th, 2005, 3:00 am
Location: Royan
Contact:

September 29th, 2010, 9:41 pm

Woh cool ! I've already noticed this function in ESTK's data browser, but never used it.
The first argument is a flag to show/hide the Transparency Grid.
The second argument is the magnification ratio.
The third argument is the exposure.

Here is another undocumented function that may be useful, though this one can be done with "regular" scripting: comp.saveFrameToPng(timeInSeconds, outputFile)

and a quick example that shows how to export frames at t = 0, 1, 2 seconds

Code: Select all

var comp = app.project.activeItem;
var outputFolderName = Folder.desktop.fsName;
for (var t = 0; t < 3; t++)
{
	comp.saveFrameToPng(t, File(outputFolderName + "/test_" + t + ".png"));
}
beginUndoGroup
Posts: 81
Joined: November 27th, 2012, 6:41 am

December 16th, 2014, 3:51 pm

Nab,

i just came across this thread and i'm puzzled.
How could you know the arguments of "saveFrameToPng" if it is not "documented" in the guide.

In ESTK data browser, its arguments are not showed.
And scouting the comp.reflect object gives nothing (those ReflectionInfo objects are ghost towns, most fields are left undefined).
In particular:

var comp = app.project.activeItem; // assume a CompItem
comp.reflect.find("saveFrameToPng").arguments.length; // 0 , should be 2
comp.reflect.find("saveFrameToPng").arguments[0]; // undefined, should be a ReflectionInfo object with name "time" or something.

I'm stuck !

Xavier.
beginUndoGroup
Posts: 81
Joined: November 27th, 2012, 6:41 am

December 16th, 2014, 3:57 pm

OK... writing the previous post i got to an "idea"... try things and read error contents, like:
comp.saveFrameToPng("Roger !"); // error : argument length should be 2
comp.saveFrameToPng("Roger", "that !"); // error : argument 1 is not a number,
comp.saveFrameToPng(1, 2); // error : argument 2 is not a File or Folder.

Hopefully, this is not way you did it, and there is one than can be "automatized".

Xavier.
Post Reply