From: Greg Ercolano <erco@(email surpressed)>
Subject: Re: AE Rush submit
   Date: Thu, 08 Aug 2013 16:49:56 -0400
Msg# 2347
View Complete Thread (13 articles) | All Threads
Last Next
On 08/08/13 11:16, Greg Ercolano wrote:
>> - Is there a way to add a custom menu to AE? like Nuke at the top menu items?
> 
> 	[..] I'll take a look at the SDK docs and see if I can answer that here.

    OK, did some research; the "After Effects Scripting Guide" seems to cover
    this best, see below for my once over of their docs.


QUICK ANSWER
------------
    TL;DR, the easy thing is to put your javascript in the "Scripts/ScriptUI Panels"
    directory if it provides its own GUI, and it will show up in the "Windows" submenu
    of AE automatically just by its presence.

    Example: create a file called Scripts/ScriptUI Panels/MyThing.jsx that contains:

function CreateMyUI(thisObj) {
    var myPanel = thisObj;
    myPanel.add("button", [10, 10, 100, 30], "Something");
    return myPanel;
}
var myToolsPanel = CreateMyUI(this);

    Then start up AE, the script appears in the AE "Windows" submenu as "MyThing.jsx".
    Click it, and it creates a panel with a button in it called 'Something'.

    This panel can be docked into the app, or exist as a separate window.

    You can flesh that out with input fields and callbacks so that when you hit a
    button it submits a job or runs an OS command. See the "AE Scripting Guide"
    for more on all that.

    I'm not seeing any examples that let you directly manipulate the AE submenus,
    so that for instance you can stick your own menu items 'anywhere' in the AE
    menubar (vis a vis Maya), but there might be a way. The above seems fine though.

    Anyway, there's a few ways to do this, here's my reduction of the AE Scripting Guide:


RUNNING SCRIPTS ON AE STARTUP
-----------------------------
    There's a section called:

	Running scripts automatically during application startup or shutdown

    ..which describes how you can put javascripts in the "Scripts/Startup" directory
    of your After Effects install directory. When AE starts, it runs
    all the scripts it finds in that directory in alphabetical order.
    So if your script wants to modify AE on startup, you could put your code there.


RUNNING SCRIPTS VIA THE "Window" MENU
-------------------------------------
    As an alternative to the above, there's a section called:

	Running scripts from the Window menu

    ..which describes how to make scripts that provide their own UI, where you put
    your script in the "Scripts/ScriptUI Panels" directory of your After Effects
    install directory which will then appear in the Window menu. There are examples
    there that show how to manipulate the panel to provide things like buttons and such.

    There's an example video here:
    http://aescripts.com/knowledgebase/index/view/faq/how-to-install-and-run-scripts/

    Or the equivalent direct youtube link:
    http://www.youtube.com/watch?v=EIm0Sa6noOk

    See my example MyThing.jsx above which describes how to do this easily.


AN OVERVIEW OF THE AVAILABLE OBJECTS YOU CAN ACCESS FROM SCRIPTS
----------------------------------------------------------------
    Next, there's a good reference section called:

		After Effects Object Model

    that covers an overview of the various objects, which gives you access
    to things like the application GUI, layers, collections, comp items,
    files, footage, import, keyframes, project, render queue, shapes,
    output module, operating system, viewer, etc.. just to name a few.

    The 'app' object gives you access to the AE application, and lets you
    do access things like AE version number info, lets you do general things
    like open project files, quit the application, etc.

    Anyway, that section should help you with general reference for deeply
    manipulating AE scene files from javascript.

-- 
Greg Ercolano, erco@(email surpressed)
Seriss Corporation
Rush Render Queue, http://seriss.com/rush/

Tel: (Tel# suppressed)ext.23
Fax: (Tel# suppressed)
Cel: (Tel# suppressed)


Last Next