Expressions/Scripts/Presets

Search found 19 matches

  • 1
  • 2
by runegan
Sat Mar 11, 2017 5:14 pm
Forum: Expression Discussion
Topic: How to Apply specific values to a Slider Control
Replies: 3
Views: 144

Re: How to Apply specific values to a Slider Control

@zlovatt:
In case you don't know: there is a 'clamp' expression function that does the same as your min/max code.

Math.max(0, Math.min(slider, valuesArray.length - 1));

Is the same as:

clamp( slider, 0, valuesArray - 1 )
by runegan
Sat Mar 11, 2017 5:03 pm
Forum: General Scripts Library
Topic: AE is crashing
Replies: 4
Views: 115

Re: AE is crashing

Are you able to create some sample code that reproduces the problem? How are you importing your libraries? Are you using @include/#include? Using multiple files should not be a problem. I have been dealing with 30+ files without any trouble. I'm thinking it may be a problem with the resolution or du...
by runegan
Tue Mar 07, 2017 9:45 am
Forum: General Scripts Library
Topic: Create sort of Metadata in AE project
Replies: 8
Views: 135

Re: Create sort of Metadata in AE project

Pulling the variables out to the outer scope is not a bad idea, as long as they are still inside your main function (i.e not polluting the global scope). Putting the variables so they are accessible from all functions can be tricky if they are going to change between executions (e.g a layer variable...
by runegan
Mon Mar 06, 2017 3:41 pm
Forum: General Scripts Library
Topic: Create sort of Metadata in AE project
Replies: 8
Views: 135

Re: Create sort of Metadata in AE project

Just to be clear: any variable you declare in your script that is not inside a function will become a global variable. You should look up javascript scope. Most people would recomend wrapping your script in a function. So you do not declare or modify any global variables, which can have unforseen co...
by runegan
Mon Mar 06, 2017 12:02 pm
Forum: General Scripts Library
Topic: Create sort of Metadata in AE project
Replies: 8
Views: 135

Re: Create sort of Metadata in AE project

You are already able to read most of the comps metadata: comp.bgColor; comp.width; comp.height; comp.numLayers; All of those, except numLayers, are read/write. So you can set to something else to change the comp. Take a look at http://docs.aenhancers.com/compitem/, http://docs.aenhancers.com/avitem/...
by runegan
Thu Feb 23, 2017 6:36 am
Forum: Scripts Discussion
Topic: How to update UI apps ?
Replies: 3
Views: 1616

Re: How to update UI apps ?

Do you have to close and reopen the comp? Or just deselect and select it in the project panel? I can't see any function to close a comp, but if you have to close it, you could try creating a new comp, open it, with comp.openInViewer(), then opening the comp you have changed in the same way. This wil...
by runegan
Thu Feb 23, 2017 5:57 am
Forum: Scripts Discussion
Topic: RegExp bug ?
Replies: 1
Views: 109

Re: RegExp bug ?

It seems to be a bug, but I can't find any information if that is because negative lookahead regex was not implemented in the javascript engine extendscript is using or a bug in extendscript itself. Either way, you can achieve what you are trying to do by using two regexes and testing the string aga...
by runegan
Tue Feb 07, 2017 7:00 am
Forum: General Scripts Library
Topic: Target specific words in text
Replies: 1
Views: 215

Re: Target specific words in text

You can only set one style for a text layer via script, if you need multiple styles you need to create more text layers and find a way to place them. If you only need to change the color, or other properties that is not the font, you can maybe look into using an expression selector on the text layer...
by runegan
Sun Jan 29, 2017 9:07 pm
Forum: Script requests
Topic: post render script to move the rendered file
Replies: 3
Views: 1872

Re: post render script to move the rendered file

Here is a script that adds a comp to the renderqueue, sets its output file, watches the renderqueue item's status changes and when the item is done, uses the MacOS shell command "mv" to move the file to the correct location. function renderAndMoveFile( compToRender ) {     var outputFolder...
by runegan
Tue Jan 24, 2017 6:08 am
Forum: Script requests
Topic: Convert 3d Rotation to Orientation
Replies: 9
Views: 4375

Re: Convert 3d Rotation to Orientation

Hey, this is a rewrite of that script which will convert orientation values to rotation values for keyframes on all orientation properties in the active comp. It does not take the original values of the rotation properties into account, so any values or keyframes on those properties may be overwritt...
by runegan
Fri Jan 13, 2017 4:05 pm
Forum: Scripts Discussion
Topic: Could somebody help out with a modified script?
Replies: 4
Views: 217

Re: Could somebody help out with a modified script?

Hmm, when I try to run the script, and there is already a comp in the renderqueue, the script works just fine. What is not working for you?
by runegan
Fri Jan 13, 2017 6:16 am
Forum: Scripts Discussion
Topic: Could somebody help out with a modified script?
Replies: 4
Views: 217

Re: Could somebody help out with a modified script?

Hi Marc! Welcome! When I run this script, I first get an error when trying to access the renderqueue, because there is nothing added to the renderqueue, somewhere in you should add a comp to the renderqueue using  app.project.renderQueue.items.add( yourCompItemVariable ); // In your code that could ...
by runegan
Fri Dec 02, 2016 5:27 am
Forum: Scripts Discussion
Topic: Run an explorer windows from After effects
Replies: 7
Views: 358

Re: Run an explorer windows from After effects

I don't work on a windows machine, but after searching a bit it seems that you will get the desired result by removing "/select,".
by runegan
Fri Dec 02, 2016 5:06 am
Forum: Scripts Discussion
Topic: Run an explorer windows from After effects
Replies: 7
Views: 358

Re: Run an explorer windows from After effects

I usually just use a File object, which will be converted to string by this code:
   if ( filePath instanceof File ) {
      filePath = filePath.fsName;
   }

Or strings that are created by accessing file.fsName somewhere else in the code.
by runegan
Fri Dec 02, 2016 4:39 am
Forum: Scripts Discussion
Topic: Run an explorer windows from After effects
Replies: 7
Views: 358

Re: Run an explorer windows from After effects

This is what I usually use, It should work on both windows and mac: function revealFile(filePath) { if ( filePath instanceof File ) { filePath = filePath.fsName; } var command = "open -R"; if ($.os.indexOf("Win") != -1) { command = "Explorer /select,"; } arg = "\&q...
  • 1
  • 2