Forum Replies Created

Page 6 of 7
  • Mitch Mann

    March 12, 2013 at 4:03 pm in reply to: Start loop from BPM question

    Put a marker on the layer where the first beat hits. Then add that marker’s time to the time calculated in the last line of your expression. If its still not sync’ed, just nudge the marker back or forth.

  • Mitch Mann

    March 8, 2013 at 7:17 pm in reply to: After Effects Expression feature request

    I’ve used a text layer to kind of do this. I just made a text layer, and the text value was generated by an expression. Then other expressions elsewhere read the source text in that text layer and use it one way or another. It was a while ago, sorry I don’t have code.

  • Mitch Mann

    March 7, 2013 at 1:50 pm in reply to: Using setActive()

    Got it working! And the solution is not setActive().

    One thing to note is that you have to call the command twice, because the first time it closes the comp window, the second time it turns it on and puts focus on it.

    So, to summarize this issue for anyone reading:

    PROBLEM: I have a script running in a ScriptUI panel that acts on layers in the activeItem. But if the user has the project panel selected (instead of timeline or composition), then there is no activeItem, its null. The script doesn’t know what to act on, and fails.

    SOLUTION: Script tests for activeItem, if there isn’t one, then running this command twice will select the comp window and make it the activeItem:
    app.executeCommand(-524309);
    app.executeCommand(-524309);

    I’m not sure how those numbers work, but I got them using Dan’s suggestion of this:
    alert (app.findMenuCommandId(“Composition: Comp 1”));

    You need to use those numbers, because the “Comp 1” will change depending on what comp is open, so you can’t call the menu command by name. I’ve tested using the command number with different comp names and it works.

    Selecting the timeline instead of the composition would work too. But be careful, if you have multiple timelines open, it won’t work. It’ll just close two of the timelines. In my workflow I have multiple timelines open for multiple comps, but I only have one comp window open (which of course changes depending on which timeline you have selected.) I suspect that if you had multiple composition windows open, then this solution would probably not work.

    Note that this has further implications that are cool. If you can shift focus to a different window, then you can run an AppleScript (from your Javascript) to hit shortcut keys and do things in that panel that you otherwise couldn’t do with scripting. Like hitting “T” to reveal opacity of selected layer.

    And that’s what I have to say about that, cheers.
    Mitch

  • Mitch Mann

    March 7, 2013 at 1:52 am in reply to: Using setActive()

    Hey Dan, I think I found a round-about way of doing it.

    If my AE javascript executes an Apple Script that strikes the key ‘backslash’, then that keyboard shortcut toggles between comp window and timeline window. So it makes the comp in the viewer the activeItem. This would solve the problem of having the Project window selected, which results in a null activeItem.

    But I’m switching back to PC soon, so I won’t bother to implement that as an Apple Script. (Anybody know if there’s something similar for Windows?

    The other thing I tried was to execute an AE menu command to do it. Like this:

    app.executeCommand(app.findMenuCommandId(“Composition: Comp 1”));

    But unfortunately the menu command name changes with the comp that’s in the viewer. So here again, it doesn’t work with an unknown comp name.

    Seems like it should be easy, but its not!
    (-:

    Cheers,
    Mitch

  • Mitch Mann

    March 6, 2013 at 9:48 pm in reply to: Using setActive()

    The comp name is unknown in my scenario. I just need to activate the viewer window. (If the project window is active, then there isn’t an “activeItem” for my script to act on.)

  • Mitch Mann

    March 6, 2013 at 6:52 pm in reply to: Find item in drop down list and select it?

    Hey, that’s clever. Thanks Dan!

  • A related curiosity: if activeItem is null (because timeline or viewer don’t have focus). Is there a way to use openInViewer to give focus to the comp that’s already open?

  • Mitch Mann

    February 13, 2013 at 2:24 am in reply to: Searching in a Treeview (scripting)

    Cool! Makes me think of building a media browser for AE, like premiere has. What are you using tree view search for?

  • Mitch Mann

    February 9, 2013 at 5:17 pm in reply to: Searching in a Treeview (scripting)

    Check out “Script UI for Dummies” for a way to do a search in a list box

    https://www.kahrel.plus.com/indesign/scriptui-2-0.pdf

    It might inspire a solution, but I don’t think it specifically addresses a search in a tree view. Let us know if you figure out a way to do it, I’d be interested in knowing!

  • Mitch Mann

    December 5, 2012 at 7:25 pm in reply to: Set Frame Blending from a script?

    You rock Dan, that’s it!

    For anyone’s future reference, this works:

    app.project.activeItem.layer(1).frameBlendingType = FrameBlendingType.FRAME_MIX;

    These DO NOT work:

    app.project.activeItem.layer(1).frameBlending = true;

    app.project.activeItem.layer(1).frameBlendingType.FRAME_MIX

    app.project.activeItem.layer(1).frameBlendingType = FRAME_MIX

Page 6 of 7

We use anonymous cookies to give you the best experience we can.
Our Privacy policy | GDPR Policy