====== AE Programming ======
https://forums.creativecow.net/thread/227/18794
http://aescripts.com/templater/
https://www.premiumbeat.com/blog/10-time-saving-tips-in-after-effects/
http://www.molecularmovies.com/img/pdf_tutorials/AEbasics.pdf
https://www.themarketingtechnologist.co/creating-dynamic-videos-using-javascript-and-after-effects-the-basics/
====== AE Expression ======
* position wiggle
fps=5; //frequency
amount=8; //amplitude
wiggle(fps,amount,octaves = 1, amp_mult = 0.5,(Math.round(time*fps))/fps);
====== AE Scripts ======
* run from cmd to call a javascript (your may or may not need full path) afterfx.exe -s "var myArg="I'm a string!"; $.evalFile("Your path to script here")"
c:\PathToAE\AfterFX.exe -r C:\"path"\"script name".jsx
* study example:
* https://www.creativecrash.com/maya/script/renderlayers-and-passes-to-after-effects
====== AE Common code ======
===== UI Code - ScriptUI =====
**Details on Javascript UI, can refer to my Photoshop javascript study**: [[appwiki:photoshop:ps_script#scriptui_in_detail|scriptUI in detail]]
* ref:
* Adobe offical ScriptUI reference (Javascript Tool Guide): https://wwwimages2.adobe.com/content/dam/acom/en/devnet/scripting/pdfs/javascript_tools_guide.pdf
* ScriptUI for dummies:
* http://www.kahrel.plus.com/indesign/scriptui.html
* https://indd.adobe.com/view/a0207571-ff5b-4bbf-a540-07079bd21d75
* https://adobeindd.com/view/publications/a0207571-ff5b-4bbf-a540-07079bd21d75/y2c4/publication-web-resources/pdf/scriptui-2-13-f-2017.pdf
* Video tutorial:
* https://www.provideocoalition.com/after-effects-extendscript-training-complete-series/
* Article tutorial:
* http://aesnippets.blogspot.com/2016/07/how-to-make-something-useful-in.html
**ScriptUI vs Dockable ScriptUI** in AfterEffects
* In general Adobe application, scriptUI are only 2 types: Pallete, Dialog; But in AfterEffects, there are 3 types: Dockable Pallete, non-dock normal Pallete, Dialog
* for ScriptUI pallete to become dockable window, it needs
- code written in certain format way
- code file need to be in ScriptUI folder in application folder, and it opened from Windows menu
**ScriptUI dockable code**
===== File Related =====
* show project file in explorer app.executeCommand(app.findMenuCommandId("Reveal in Explorer"));
* show layer file path var theLayer = app.project.activeItem.selectedLayers[0];
alert(theLayer.source.file.fsName);
* reveal layer source in project panel// ref: http://www.smipple.net/snippet/francoisgfx/Reveal%20Layers%20in%20Project
var proj = app.project;
var comp = proj.activeItem;
if(comp){
var selectedLayers = comp.selectedLayers;
if(selectedLayers.length > 0){
for(var l = 0 ; l < selectedLayers.length ; l++){
selectedLayers[l].source.selected = true;
}
}
}
===== Application Level =====
* write to info panel as output write('info here'); writeln('info breakline');
* app interaction
app.activate(); // bring to front
app.beginSuppressDialogs(); // no error pop-up; endSuppressDialogs
// make undo group
app.beginUndoGroup(commentString);
app.endUndoGroup(commentString);
* current info
app.activeViewer; // current focused viewer (comp, layer, footage panel)
===== Comp and footage, Layer, Property =====
* get all item (Comp and Footage)
===== keyframe, animation, expression =====
* set expression for selected attributes // ref: http://www.smipple.net/snippet/francoisgfx/Set%20Expression%20to%20selected%20property%20%28in%20AE%29
var link_expression = 'wiggle(10,30);'
var cur_comp = app.project.activeItem; // our current selected & opened comp
if(cur_comp && cur_comp.selectedLayers[0].selectedProperties[0]){ // if a comp and at least one property is selected
for(var i = 0 ; i < cur_comp.selectedLayers.length; i++){ // go trough each selected layers
var cur_layer = cur_comp.selectedLayers[i];
for(var j = 0 ; j < cur_layer.selectedProperties.length; j++){ // go through each selected properties
var cur_attr = cur_layer.selectedProperties[j];
if(cur_attr.canSetExpression) {
cur_attr.expression = link_expression;
}else{
alert("Can't add expression to the selected property");
};
};
};
}else{
alert("properties of an effect or a layer has to be selected");
};
===== Render Related =====
* example app.project.renderQueue.items.add(myComp).applyTemplate("TemplateName");
===== Network related =====
* since CS5 for Bridge, InDesign, InCopy, AE, Photoshop have socket object
===== addition script to read =====
* http://www.smipple.net/tag/ae
* http://www.adobepress.com/articles/article.asp?p=1648576&seqNum=3
* script UI builder: https://aescripts.com/p9-scriptui-builder/