Open a comp

Find out why the . goes before the /

Moderator: Paul Tuersley

Post Reply
francoisgfx
Posts: 15
Joined: June 5th, 2010, 7:06 am

June 6th, 2010, 1:32 am

Hi,

I'm doing a in-house AE script which is a kind of automatisation task and wiazard at the same time. So the goal is to limitate the user's click and do a maximum of thing for him! Since its also a wizard the script will sometimes be on hold waiting for user interaction and the continue!
Right now all I have is the user selecting a footage on the HDD & AE does all the job of importing & creating the comps! (very basic) But then the user will have to interact with one of the comp which as been created! I'd like to open it for him! How do I do that ?
Right now all I can find out is to select it in tje project folder but that's all!
I understand that this might not be possible in a standard way for security issue, but since it is a in-house tool any suggestions are welcome (macros, script...)!
I also tried the executecommand() with the "new comp menu" since it does open it after creation but I do have the issue of an intermediate panel comp setting which I don't belive I can control,skip or validate :(

so any idea??

Thx a lot
francoisgfx
Posts: 15
Joined: June 5th, 2010, 7:06 am

June 7th, 2010, 2:45 pm

I guess that's a no ? :?
Paul Tuersley
Posts: 704
Joined: June 5th, 2004, 7:59 am
Location: London, UK

June 10th, 2010, 3:20 am

You're right, there's no way to do this.

I also have many scripts that would benefit from being able to reveal comps, layers and properties in AE's UI but there is currently no such functionality.

Here's a link to Adobe's feature request form. The more people that ask, the more likely we'll get it in a future version:
https://www.adobe.com/cfusion/mmform/in ... e=wishform
zold

June 14th, 2010, 4:44 pm

Ok I admit that I'm being lazy about this by not actually coding the solution.
But I believe the following point can lead to a solution, albeit kludgey:

The only way to open a comp when there is no comp opened (e.g., when only the project item is selected but comp/timeline not opened) is to do a "app.executeCommand(2796)", which activates the "New Comp from Selection" menu item. This does NOT duplicate the selected comp; it nests the comp into a new one.
If one were to use this method, one would need to (via script) delete the "original comp" LAYER in the new comp, then copy all the layers from the original comp, put them in the new comp, then delete (".remove()") the original comp. Voila, opened comp should be exactly like the original.
Weird, yes, but wouldn't that work?
I'll bet no one even wants to do this.

and by the way, I like exclamation points, too!! :wink:
francoisgfx
Posts: 15
Joined: June 5th, 2010, 7:06 am

June 14th, 2010, 11:40 pm

I actually talked about this idea in my post, but the issue still the dialog box opened by this command. How do you deal with it ? How do you validate it ?!

I really don't understand why they do not allow it! And I dont think it's a security issue anymore since there is stuff like socket, read/write on Harddrive without limitation, start other program !!! ... Plus there is stuff like renderQ.showWindow(). That's really too bad !
Paul Tuersley
Posts: 704
Joined: June 5th, 2004, 7:59 am
Location: London, UK

June 15th, 2010, 4:38 am

Zold's suggestion was to use a different app.executeCommand that doesn't result in a dialog appearing. But it also requires copying every aspect of every layer from one comp to another which would take a lot of work. He's right in saying no one would want to do it that way. ;)

It isn't really that After Effects "do not allow it" as much as they simply haven't implemented this functionality. It's something that I've requested many times, but it needs more people asking for it to make it happen, which is why I posted the link to Adobe's feature request page.
zold

June 15th, 2010, 4:12 pm

Paul Tuersley wrote:He's right in saying no one would want to do it that way.
Well, I would if I were in the mood to. It's not a terrible solution, but kludgey.
Paul, do you have CS5? Does app.executeCommand(2796) behave the same way? Also, since CS5 is Cocoa, doesn't this open up a whole universe of automation, using cocoa-friendly hooks, say from applescript or F-Script, etc.? Just curious. Soon I'll be upgrading.

Hope all is well

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

June 15th, 2010, 5:57 pm

Or...

Code: Select all

alert("Execution finished. Please open SuperComp.");
francoisgfx
Posts: 15
Joined: June 5th, 2010, 7:06 am

June 16th, 2010, 2:45 am

Paul Tuersley wrote:Zold's suggestion was to use a different app.executeCommand that doesn't result in a dialog appearing. But it also requires copying every aspect of every layer from one comp to another which would take a lot of work. He's right in saying no one would want to do it that way. ;)

It isn't really that After Effects "do not allow it" as much as they simply haven't implemented this functionality. It's something that I've requested many times, but it needs more people asking for it to make it happen, which is why I posted the link to Adobe's feature request page.
oopps my bad, did read it too fast :?
actually in my case it could work since the comp are pretty small and easy to setup.

I do have a function which create a comp with params from an imported footage. then I insert this footage into the comp.
What I could do (as a hack), it's create first an empty comp / excuteCommand() / remove old comp / set the params / insert footage.

This should work right ?

gonna give a try
francoisgfx
Posts: 15
Joined: June 5th, 2010, 7:06 am

June 16th, 2010, 3:56 am

this works great for me ! Thanks guys !!

cheers

Code: Select all

function CreateCompAndOpen(compName,footageItem){

//Create a temp composition with all parameters
var tempComp = app.project.addComp(compName, footageItem.width, footageItem.height, footageItem.pixelAspect, footageItem.duration, footageItem.frameRate);

//make sure it's selected
tempComp.selected = true;

//execute the menu "New Comp from Selection" (this will duplicate the current comp & open it)
app.executeCommand(app.findMenuCommandId("New Comp from Selection")); //2796

//remove the original comp from project
tempComp.remove();

//store the new comp into an object
var Comp = me.project.activeItem;

//rename the new comp with the correct name
Comp.name = compName;

/*
   Do all the stuff you want in your comp here
*/

//return the comp object in case you need it later
return Comp;
		
}

zold

June 16th, 2010, 9:34 pm

francoisgfx wrote:(this will duplicate the current comp & open it)
This comment is a little deceiving; as I mentioned, this command does not duplicate the comp, it nests it within a new comp (whose properties are identical).

glad to know this is working for you

-cg!!
francoisgfx
Posts: 15
Joined: June 5th, 2010, 7:06 am

June 17th, 2010, 12:23 am

zold wrote:
francoisgfx wrote:(this will duplicate the current comp & open it)
This comment is a little deceiving; as I mentioned, this command does not duplicate the comp, it nests it within a new comp (whose properties are identical).

glad to know this is working for you

-cg!!
oh yeah true, just forgot to change it :p
Anyway thx for your help ! ;)
This is really great and will save a lot of time in my production pipeline
User avatar
zenpai
Posts: 1
Joined: April 13th, 2019, 11:52 pm

April 13th, 2019, 11:58 pm

myComp.openInViewer();
Post Reply