AFX Shelf

From bernie's
Jump to navigation Jump to search

Saved from the wayback machine, thank you the wayback machine.

Old but might help.

////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
//  Quick_Fx_Palette 1.2    moded from script by Fred CRETET
////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////



var But_01=["Fst Blr",			// text on button, max is 7 char
					"fx",				// fx or preset
					"Fast Blur",		//exact effect name or preset path (copy the name in effects pallette in AE)
					"Blurriness",		// custom property name only for fx (if you want to modify one default property for exemple the fast blur blurriness is "0" , to modify more one property you could create a  preset)
					9];					//custom property value for fx
					
var But_02=["Ramp",			// text on button,  max is 7 char
					"fx",				// fx or preset
					"Ramp"];	//exact effect name or preset path (copy the name in effects pallette in AE)
															// custom property name only for fx (if you want to modify one default property for exemple the fast blur blurruness is "0" , to modify more one property you could create a  preset)
															//custom property value for fx
var But_03=["Level",			// text on button,  max is 7 char
					"fx",				// fx or preset
					"Levels (Individual Controls)"];	//exact effect name or preset path (copy the name in effects pallette in AE)
															// custom property name only for fx (if you want to modify one default property for exemple the fast blur blurruness is "0" , to modify more one property you could create a  preset)
															//custom property value for fx
var But_04=["HueSat",			// text on button,  max is 7 char
					"fx",				// fx or preset
					"Hue/Saturation"];	//exact effect name or preset path (copy the name in effects pallette in AE)
															// custom property name only for fx (if you want to modify one default property for exemple the fast blur blurruness is "0" , to modify more one property you could create a  preset)
															//custom property value for fx

var But_05=["Curves",			// text on button,  max is 7 char
					"fx",				// fx or preset
					"Curves"];	//exact effect name or preset path (copy the name in effects pallette in AE)
															// custom property name only for fx (if you want to modify one default property for exemple the fast blur blurruness is "0" , to modify more one property you could create a  preset)
															//custom property value for fx

var But_06=["Invert",			// text on button,  max is 7 char
					"fx",				// fx or preset
					"Invert"];	//exact effect name or preset path (copy the name in effects pallette in AE)
															// custom property name only for fx (if you want to modify one default property for exemple the fast blur blurruness is "0" , to modify more one property you could create a  preset)
															//custom property value for fx

var But_07=["Choke",			// text on button,  max is 7 char
					"fx",				// fx or preset
					"Simple Choker"];	//exact effect name or preset path (copy the name in effects pallette in AE)
															// custom property name only for fx (if you want to modify one default property for exemple the fast blur blurruness is "0" , to modify more one property you could create a  preset)
															//custom property value for fx	

var But_08=["Photo F.",			// text on button,  max is 7 char
					"fx",				// fx or preset
					"Photo Filter"];	//exact effect name or preset path (copy the name in effects pallette in AE)
															// custom property name only for fx (if you want to modify one default property for exemple the fast blur blurruness is "0" , to modify more one property you could create a  preset)
															//custom property value for fx
															
var But_09=["Fill",			// text on button,  max is 7 char
					"fx",				// fx or preset
					"Fill",		//exact effect name or preset path (copy the name in effects pallette in AE)
					"Color",		// custom property name only for fx (if you want to modify one default property for exemple the fast blur blurruness is "0" , to modify more one property you could create a  preset)
					[255,255,255]];				//custom property value for fx

var But_13=["Turb Disp",			// text on button,  max is 7 char
					"fx",				// fx or preset
					"Turbulent Displace",		//exact effect name or preset path (copy the name in effects pallette in AE)
					"Size",		// custom property name only for fx (if you want to modify one default property for exemple the fast blur blurruness is "0" , to modify more one property you could create a  preset)
					"4"];				//custom property value for fx
var But_15=["CC Comp",			// text on button,  max is 7 char
					"fx",				// fx or preset
					"CC Composite"];				//custom property value for fx
					/*
var But_13=["601 to RGB",			// text on button,  max is 7 char
					"preset",				// fx or preset
					"C:/Program Files (x86)/Adobe/Adobe After Effects CS4/Support Files/Presets/Image - Utilities/Levels - video to computer.ffx"];	//exact effect name or preset path (copy the name in effects pallette in AE)
															// custom property name only for fx (if you want to modify one default property for exemple the fast blur blurruness is "0" , to modify more one property you could create a  preset)
															//custom property value for fx
	*/														
////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////

{
   var myPanel;
   function Quick_fx_palette(thisObj) {
      myPanel = (thisObj instanceof Panel) ? thisObj : new Window("palette", "Fx_palette", [100, 100, 300, 300]);
      //Jeff Almasol's solution to fix text color
      var winGfx = myPanel.graphics;
      var darkColorBrush = winGfx.newPen(winGfx.BrushType.SOLID_COLOR, [0,0,0], 1);

     bw = 63;
     mg = 5;
     bh = 21;
     lm = 10;
	 lmm = 12;
        b=1;
     
    myPanel.but_01 = myPanel.add("button", [lm, mg, bw+lm, mg+bh], But_01[0]);
    myPanel.but_02 = myPanel.add("button", [bw*b+mg+lm, mg, bw*(b+1)+lm, mg+bh], But_02[0]);b++;
    myPanel.but_13 = myPanel.add("button", [bw*b+mg+lm, mg, bw*(b+1)+lm, mg+bh], But_13[0]);b++;
    myPanel.but_03 = myPanel.add("button", [bw*b+mg+lm, mg, bw*(b+1)+lm, mg+bh], But_03[0]);b++;
    lm += lmm;
    myPanel.but_04 = myPanel.add("button", [bw*b+mg+lm, mg, bw*(b+1)+lm, mg+bh], But_04[0]);b++;
    myPanel.but_05 = myPanel.add("button",[bw*b+mg+lm, mg, bw*(b+1)+lm, mg+bh], But_05[0]);b++;
    myPanel.but_06 = myPanel.add("button",[bw*b+mg+lm, mg, bw*(b+1)+lm, mg+bh], But_06[0]);b++;
    myPanel.but_07 = myPanel.add("button",[bw*b+mg+lm, mg, bw*(b+1)+lm, mg+bh], But_07[0]);b++;
    lm += lmm;
    myPanel.but_08 = myPanel.add("button", [bw*b+mg+lm, mg, bw*(b+1)+lm, mg+bh], But_08[0]);b++;
    myPanel.but_09 = myPanel.add("button", [bw*b+mg+lm, mg, bw*(b+1)+lm, mg+bh], But_09[0]);b++;
    myPanel.but_10 = myPanel.add("button",[bw*b+mg+lm, mg, bw*(b+1)+lm, mg+bh],"Vign Dof");b++;
    myPanel.but_15 = myPanel.add("button", [bw*b+mg+lm, mg, bw*(b+1)+lm, mg+bh], But_15[0]);b++;
    lm += lmm;
    myPanel.but_12 = myPanel.add("button", [bw*b+mg+lm, mg, bw*(b+1)+lm, mg+bh], "Vignette");b++;
    myPanel.but_16 = myPanel.add("button", [bw*b+mg+lm, mg, bw*(b+1)+lm, mg+bh], "Rimlights");b++;
    myPanel.but_17 = myPanel.add("button", [bw*b+mg+lm, mg, bw*(b+1)+lm, mg+bh], "ShakeCam");b++;
    myPanel.but_19 = myPanel.add("button", [bw*b+mg+lm, mg, bw*(b+1)+lm, mg+bh], "Sep RGB");b++;
	myPanel.but_19.enabled = false;
    lm += lmm;
    myPanel.but_18 = myPanel.add("button", [bw*b+mg+lm, mg, bw*(b+1)+lm, mg+bh], "Loop Lyrs");b++;
        myPanel.but_23 = myPanel.add("button", [bw*b+mg+lm, mg, bw*(b+1)+lm, mg+bh], "Seq Lyrs");b++;
    
    myPanel.but_21 = myPanel.add("button", [bw*b+mg+lm, mg, bw*(b+1)+lm, mg+bh], "Trim Cmp");b++;
    o = app.preferences.getPrefAsLong("MP - CS5 - 4", "MP - Enable");
    myPanel.but_22 = myPanel.add("button", [bw*b+mg+lm, mg, bw*(b+1)+lm, mg+bh], ("MP: "+((o)?"on":"off")));b++;
    lm += lmm;
    myPanel.but_20 = myPanel.add("button", [bw*b+mg+lm, mg, bw*(b+1)+lm, mg+bh], "Crop Cmp");b++;
 /*   myPanel.but_20 = myPanel.add("button", [bw*b+mg+lm, mg, bw*(b+1)+lm, mg+bh], "Replace");b++;
	 myPanel.but_17 = myPanel.add("button", [855, 5, 895, 25], But_17[0]);	 
	 myPanel.but_18 = myPanel.add("button", [905, 5, 965, 25], But_18[0]);*/
	 
        myPanel.but_01.onClick =ApplyFx01;
        myPanel.but_02.onClick =ApplyFx02;
        myPanel.but_03.onClick =ApplyFx03;
        myPanel.but_04.onClick =ApplyFx04;

        myPanel.but_05.onClick =ApplyFx05;
        myPanel.but_06.onClick =ApplyFx06;
        myPanel.but_07.onClick =ApplyFx07; 
        myPanel.but_08.onClick =ApplyFx08;

        myPanel.but_09.onClick =ApplyFx09;
        myPanel.but_10.onClick =ApplyFx10;
        //myPanel.but_11.onClick =ApplyFx11; 
        myPanel.but_12.onClick =ApplyFx12;
        myPanel.but_13.onClick =ApplyFx13;

        myPanel.but_15.onClick =ApplyFx15;
        myPanel.but_16.onClick =ApplyFx16;
        myPanel.but_17.onClick =shkCam;
        myPanel.but_18.onClick =loopLayers;
        myPanel.but_19.onClick = function(){}; //sepRGB;
        myPanel.but_20.onClick = function(){app.executeCommand(app.findMenuCommandId("Crop Comp to Region of Interest"))};
        myPanel.but_21.onClick = function(){app.executeCommand(app.findMenuCommandId("Trim Comp to Work Area"))};
       myPanel.but_22.onClick = changeMP;
       myPanel.but_23.onClick =  function(){app.executeCommand(app.findMenuCommandId("Sequence Layers..."))};
       
	 
      return myPanel;

}
function changeMP(){
      o = app.preferences.getPrefAsLong("MP - CS5 - 4", "MP - Enable");
      app.preferences.savePrefAsLong("MP - CS5 - 4", "MP - Enable",((o)?0:1));
      myPanel.but_22.text = ((o)?"MP: off":"MP: on");
    }

function ApplyFx01(){
	if(But_01[01]=="fx")
		{
			ApplyFx(But_01[2],But_01[3],But_01[4]);
		}
	if(But_01[01]=="preset")
		{
			ApplyPresetbutton(But_01[2]);
		}

}

function ApplyFx02(){
	if(But_02[01]=="fx")
		{
			ApplyFx(But_02[2],But_02[3],But_02[4]);
		}
	if(But_02[01]=="preset")
		{
			ApplyPresetbutton(But_02[2]);
		}

}

function ApplyFx03(){
	if(But_03[01]=="fx")
		{
			ApplyFx(But_03[2],But_03[3],But_03[4]);
		}
	if(But_03[01]=="preset")
		{
			ApplyPresetbutton(But_02[2]);
		}

}

function ApplyFx04(){
	if(But_04[01]=="fx")
		{
			ApplyFx(But_04[2],But_04[3],But_04[4]);
		}
	if(But_04[01]=="preset")
		{
			ApplyPresetbutton(But_04[2]);
		}

}

function ApplyFx05(){
	if(But_05[01]=="fx")
		{
			ApplyFx(But_05[2],But_05[3],But_05[4]);
		}
	if(But_05[01]=="preset")
		{
			ApplyPresetbutton(But_05[2]);
		}

}

function ApplyFx06(){
	if(But_06[01]=="fx")
		{
			ApplyFx(But_06[2],But_06[3],But_06[4]);
		}
	if(But_06[01]=="preset")
		{
			ApplyPresetbutton(But_06[2]);
		}

}

function ApplyFx07(){
	if(But_07[01]=="fx")
		{
			ApplyFx(But_07[2],But_07[3],But_07[4]);
		}
	if(But_07[01]=="preset")
		{
			ApplyPresetbutton(But_07[2]);
		}

}

function ApplyFx08(){
	if(But_08[01]=="fx")
		{
			ApplyFx(But_08[2],But_08[3],But_08[4]);
		}
	if(But_08[01]=="preset")
		{
			ApplyPresetbutton(But_08[2]);
		}

}

function ApplyFx09(){
	if(But_09[01]=="fx")
		{
			ApplyFx(But_09[2],But_09[3],But_09[4]);
		}
	if(But_09[01]=="preset")
		{
			ApplyPresetbutton(But_09[2]);
		}

}

function ApplyFx10(){
    app.beginUndoGroup("Create Vignette");
    myComp = app.project.activeItem;
    if(myComp != null){
        newComp = app.project.items.addComp("vignetteComp",myComp.width,myComp.height,1.0,myComp.duration,1/myComp.frameDuration);
        whiteSolid = newComp.layers.addSolid([1,1,1], "White", myComp.width, myComp.height, 1);
        blackSolid = newComp.layers.addSolid([0,0,0], "Black", myComp.width, myComp.height, 1);
        newMask = blackSolid.Masks.addProperty("Mask");
        newMask.inverted = true;
        myMaskShape = newMask.property("maskShape");
        myMaskFeather = newMask.property("maskFeather");
        myMaskExpansion = newMask.property("ADBE Mask Offset");
        myShape = myMaskShape.value;
        w =myComp.width;
        h=myComp.height;
        r = 2;
        myShape.vertices = [[w/2,0],[w,h/2],[w/2,h],[0,h/2]];
        myShape.inTangents = [[-w/r,0],[0,-h/r],[w/r,0],[0,h/r]];
        myShape.outTangents = [[w/r,0],[0,h/r],[-w/r,0],[0,-h/r]];
        myShape.closed = true;
        myMaskShape.setValue(myShape);
        myMaskFeather.setValue([300,300]);
        myMaskExpansion.setValue(110);
        vignetteLayer = myComp.layers.add(newComp);
        vignetteLayer.property("opacity").setValue(14);
        vignetteLayer.blendingMode = BlendingMode.MULTIPLY;
        adjLayer = myComp.layers.addSolid([1,1,1],"Vignette DOF",myComp.width,myComp.height,1.0);
        adjLayer.adjustmentLayer = true;
        v = adjLayer.Effects.addProperty("DRFL Depth of Field");
        v.property("depth layer").setValue(vignetteLayer.index);
        v.property("radius").setValue(12);
        v.property("horizontal assume").setValue(2);
        v.property("vertical assume").setValue(2);
    }else{
        writeLn("No active comp");
    }
    app.endUndoGroup();
}


function ApplyFx11(){
var securitySetting = app.preferences.getPrefAsLong("Main Pref Section", "Pref_SCRIPTING_FILE_NETWORK_SECURITY");
    if(securitySetting == 1){
        a = system.callSystem("W:/09_Dandelions_COMP-SHOWS/Resources/DandyQuickPanel/clickmetoinstall.bat");
        alert(a+"\n\nYou'll need to relaunch After Effects to get the latest version.");
    }else{
        alert("Allow script network usage in prefs to fetch latest version.");
    }

}

function ApplyFx12(){
    //creates a vignette
    comp = app.project.activeItem;
    layers = comp.layers;
    vignette = layers.addSolid([0,0,0],"Vignette",2048,2048,1);
    vignette.opacity.setValue(20);
    vignette.blendingMode = BlendingMode.OVERLAY; 
    ramp = vignette.property("Effects").addProperty("Ramp");
    ramp("Start of Ramp").setValue([1024,1024]);
    ramp("Start Color").setValue([1,1,1]);
    ramp("End of Ramp").setValue([1024,2800]);
    ramp("End Color").setValue([0,0,0]);
    ramp("Ramp Shape").setValue(2);
    vignette.scale.setValue([100,52.7344]);
}

function ApplyFx13(){
	if(But_13[01]=="fx")
		{
			ApplyFx(But_13[2],But_13[3],But_13[4]);
		}
	if(But_13[01]=="preset")
		{
			ApplyPresetbutton(But_13[2]);
		}

}

function ApplyFx15(){
	if(But_15[01]=="fx")
		{
			ApplyFx(But_15[2],But_15[3],But_15[4]);
		}
	if(But_15[01]=="preset")
		{
			ApplyPresetbutton(But_15[2]);
		}

}

function ApplyFx16(){
    createRimlights();
}



function ApplyFx18(){
	if(But_18[01]=="fx")
		{
			ApplyFx(But_18[2],But_18[3],But_18[4]);
		}
	if(But_18[01]=="preset")
		{
			ApplyPresetbutton(But_18[2]);
		}

}
///////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
function ApplyFx(Effect_Name,CustomProperty,CustomValue){
	app.beginUndoGroup("Apply Fx");
	if ((app.project.activeItem == null) || ((app.project.activeItem != null) && !(app.project.activeItem instanceof CompItem)))
		{
		}
	else
		{
				var comp = app.project.activeItem;
				var layerCollection = comp.selectedLayers;
				for (idx=0;idx<layerCollection.length;idx++)
					{
						if(CustomProperty==null){
							layerCollection[idx].Effects.addProperty(Effect_Name);
						}
						else{
							layerCollection[idx].Effects.addProperty(Effect_Name).property(CustomProperty).setValue(CustomValue);
						}
					}
		}
	app.endUndoGroup();
}

///////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
function ApplyPresetbutton(PresetPath){
	app.beginUndoGroup("Apply Preset");
	 var myPreset = File(PresetPath);
	if ((app.project.activeItem == null) || ((app.project.activeItem != null) && !(app.project.activeItem instanceof CompItem)))
		{
		}
	else
		{
				var comp = app.project.activeItem;
				var layerCollection = comp.selectedLayers;
				for (idx=0;idx<layerCollection.length;idx++)
					{						
							layerCollection[idx].applyPreset(myPreset);
						
					}
		}
	app.endUndoGroup();
}


 Quick_fx_palette(this); 
 }
function createRimlights(){
    ug = app.beginUndoGroup("Undo rimlights");
    var comp = app.project.activeItem;
    var layerCollection = comp.selectedLayers;
    for (idx=0;idx<layerCollection.length;idx++){
        /*line = layerCollection[idx].duplicate();
        line.name = layerCollection[idx].name + " (extract line)";*/
        mask = layerCollection[idx].duplicate();
        mask.name = layerCollection[idx].name + " (mask - move me)";
        rim =  layerCollection[idx].duplicate();
        rim.name = layerCollection[idx].name + " (rim)";
        rim.trackMatteType = TrackMatteType.ALPHA_INVERTED;

        //baseControl    
        //angleCtrl = layerCollection[idx].
        
        //line
        /*line.blendingMode = BlendingMode.MULTIPLY; 
        extract = line.property("Effects").addProperty("Extract");
        extract("Black Point").setValue(13);
        extract("Invert").setValue(1);
        line.visibility = false;
        
        line.parent = layerCollection[idx];*/
        mask.parent = layerCollection[idx];
     //   extract.parent = layerCollection[idx];
        rim.parent = layerCollection[idx];
         
         //rim
        aCtrl = rim.property("Effects").addProperty("Angle Control");
        aCtrl.name = "Rimlight angle";
        aCtrl("Angle").setValue(45);
        rCtrl = rim.property("Effects").addProperty("Slider Control");
        rCtrl.name = "Distance";
        rCtrl("Slider").setValue(8);
        dCtrl = rim.property("Effects").addProperty("Slider Control");
        dCtrl.name = "Roundness";
        dCtrl("Slider").setValue(7);
        
        levelsR = rim.property("Effects").addProperty("Levels (Individual Controls)");
        levelsR.name = "Rimlight Color Correction"
        levelsR("Gamma").setValue(2.15);  
        //mask
        fastBlur = mask.property("Effects").addProperty("Fast Blur");
        fastBlur("Blurriness").setValue(20);
        fastBlur("Blurriness").expressionEnabled = true;
        fastBlur("Blurriness").expression = "thisComp.layer(\""+rim.name+"\").effect(\"Roundness\")(\"Slider\")";
        fastBlur("Repeat Edge Pixels").setValue(1);
        levels = mask.property("Effects").addProperty("Levels (Individual Controls)");
        levels.name = "Alpha Squeeze";
        levels("Alpha Input Black").setValue(0.45);
        levels("Alpha Input White").setValue(0.55);
        //mask.position.setValue([mask.transform.position.value[0]-5,mask.transform.position.value[1]+5]);
        mask.transform.position.expressionEnabled = true;
        //mask.transform.position.expression =  "[thisComp.layer(\""+rim.name+"\").effect(\"Rimlight angle\")(\"Angle\"),0]";
        mask.transform.position.expression = "p=transform.position;\nv = thisComp.layer(\""+rim.name+"\").effect(\"Rimlight angle\")(\"Angle\")/180*Math.PI+Math.PI/2;\nd = thisComp.layer(\""+rim.name+"\").effect(\"Distance\")(\"Slider\");\n[p[0]+Math.cos(v)*d,p[1]+Math.sin(v)*d];";
        layerCollection[idx].selected=false;
        rim.selected=true;
        //levels("Alpha")("Alpha Input White").setValue(216);
            
        

        
        //expressions:

        
    }


    app.endUndoGroup();
}

function shkCam(){
    ug = app.beginUndoGroup("Undo shakecam");
    var comp = app.project.activeItem;
    var layerCollection = comp.selectedLayers;
    for (idx=0;idx<layerCollection.length;idx++){
       sCtrl1 = layerCollection[idx].property("Effects").addProperty("Slider Control");
       sCtrl1.name = "Frequence";
       
       sCtrl2 = layerCollection[idx].property("Effects").addProperty("Slider Control");
       sCtrl2.name = "Amplitude";
       
       sCtrl3 = layerCollection[idx].property("Effects").addProperty("Slider Control");
       sCtrl3.name = "Rotation Amplitude";
       sCtrl3("Slider").setValue(20);
       
       ssr = layerCollection[idx].property("Effects").addProperty("CC Repetile");
       ssr("Expand Right").setValue(200);
       ssr("Expand Left").setValue(200);
        ssr("Expand Down").setValue(200);       
        ssr("Expand Up").setValue(200);
        ssr("Tiling").setValue(4);
        
         layerCollection[idx].transform.position.expressionEnabled = true;
      //   layerCollection[idx].transform.position.expression = "[999,999]";
       layerCollection[idx].transform.position.expression = "wiggle(effect(\"Frequence\")(\"Slider\"),effect(\"Amplitude\")(\"Slider\"))";
       layerCollection[idx].transform.rotation.expressionEnabled = true;
       layerCollection[idx].transform.rotation.expression = "wiggle(effect(\"Frequence\")(\"Slider\"),effect(\"Amplitude\")(\"Slider\"))/effect(\"Rotation Amplitude\")(\"Slider\")";
    }
    app.endUndoGroup();
}
function loopLayers(){
    app.beginUndoGroup("Set loops");
    var layersList = app.project.activeItem.selectedLayers;
    var frameD = app.project.activeItem.frameDuration;
    for (i=0;i<layersList.length;i++){
        if(!layersList[i].timeRemapEnabled){
            var outP = layersList[i].outPoint;
            layersList[i].timeRemapEnabled = true;
            layersList[i].timeRemap.setValueAtTime(outP-frameD,outP-frameD);
            layersList[i].timeRemap.setValueAtTime(outP,0);
            layersList[i].timeRemap.expressionEnabled = true;
            layersList[i].timeRemap.expression = "loopOut()";
        }
    }
    app.endUndoGroup();
}

shelf v2

function e(s){$.writeln(s)}


// [buttonlaber, effect name or preset name, "fx" or "preset", 
var simpleEffects = [
[ "Fst blur"	, "Fast Blur" 			, "fx" , [ "Blurriness" , 9 ] , [ "Repeat Edge Pixels" , 1 ] ],
[ "Ramp V"	 	, "Ramp"				, "fx" ],
[ "Ramp H"		, "Ramp"				, "fx" , [ "Start of Ramp" , [0 , 0] ] , [ "End of Ramp" , "Expression", "[thisComp.width,0]"] ],
[ "Lvls"		, "ADBE Easy Levels2"	, "fx" ],
[ "Huesat"		, "ADBE HUE SATURATION"	, "fx" ],
[ "Curves"		, "ADBE CurvesCustom"	, "fx" ],
[ "Invert"		, "ADBE Invert"	, "fx" ] 
];






{
	var myPanel;
	
	function bernieShelf(thisObj) {
		myPanel = (thisObj instanceof Panel) ? thisObj : new Window("palette", "bernieShelf", [100, 100, 300, 300]);
		var res = 
		"group { \
			alignment: ['fill','fill'], \
			alignChildren: ['fill','top'], \
			orientation: 'row', \
			}";	
				//			setWF: Button {text: 'add btn' ,preferredSize:[-1,30]} , \
				//sendWF: Button {text: 'Send To Watchfolder' ,preferredSize:[-1,30]} , \
		myPanel.grp = myPanel.add(res);
		addButtons(myPanel.grp);
		resfreshUI(myPanel);
		return myPanel;
		
	}


	function addButtons(src){
		for( i = 0 ; i < simpleEffects.length; i++){
			e(simpleEffects[i][0]);
			src.add("button", undefined, simpleEffects[i][0]);
			
		}
	}

	function resfreshUI(src){
		src.layout.layout(true);
		src.layout.resize();
		src.onResizing = src.onResize = function () {this.layout.resize();}

	}


	bernieShelf(this);
//alert(simpleEffects[3][0]);
}




Elements

Vignette FL Depth of Field

{
    app.beginUndoGroup("Create Vignette");
    myComp = app.project.activeItem;
    if(myComp != null){
        newComp = app.project.items.addComp("vignetteComp",myComp.width,myComp.height,1.0,myComp.duration,1/myComp.frameDuration);
        whiteSolid = newComp.layers.addSolid([1,1,1], "White", myComp.width, myComp.height, 1);
        blackSolid = newComp.layers.addSolid([0,0,0], "Black", myComp.width, myComp.height, 1);
        newMask = blackSolid.Masks.addProperty("Mask");
        newMask.inverted = true;
        myMaskShape = newMask.property("maskShape");
        myMaskFeather = newMask.property("maskFeather");
        myMaskExpansion = newMask.property("ADBE Mask Offset");
        myShape = myMaskShape.value;
        w =myComp.width;
        h=myComp.height;
        r = 2;
        myShape.vertices = [[w/2,0],[w,h/2],[w/2,h],[0,h/2]];
        myShape.inTangents = [[-w/r,0],[0,-h/r],[w/r,0],[0,h/r]];
        myShape.outTangents = [[w/r,0],[0,h/r],[-w/r,0],[0,-h/r]];
        myShape.closed = true;
        myMaskShape.setValue(myShape);
        myMaskFeather.setValue([300,300]);
        myMaskExpansion.setValue(110);
        vignetteLayer = myComp.layers.add(newComp);
        vignetteLayer.property("opacity").setValue(14);
        vignetteLayer.blendingMode = BlendingMode.MULTIPLY;
        adjLayer = myComp.layers.addSolid([1,1,1],"Vignette DOF",myComp.width,myComp.height,1.0);
        adjLayer.adjustmentLayer = true;
        v = adjLayer.Effects.addProperty("DRFL Depth of Field");
        v.property("depth layer").setValue(vignetteLayer.index);
        v.property("radius").setValue(12);
        v.property("horizontal assume").setValue(2);
        v.property("vertical assume").setValue(2);
    }else{
        writeLn("No active comp");
    }
    app.endUndoGroup();
}

wip V3

function d(s){
	//debugger
	var today = new Date();
	var time = today.toLocaleTimeString(); ;

	//writeLn(time+' '+string(s));
	writeLn(time + ' ' + s.toString());
	//$.writeln(s)
}


// [buttonlaber, effect name or preset name, "fx" or "preset", 
var simpleEffects = [
[ "Fst blur"	, "Fast Blur" 			, "fx" , [ "Blurriness" , 9 ] , [ "Repeat Edge Pixels" , 1 ] ],
[ "Ramp V"	 	, "Ramp"				, "fx" ],
[ "Ramp H"		, "Ramp"				, "fx" , [ "Start of Ramp" , [0 , 0] ] , [ "End of Ramp" , "Expression", "[thisComp.width,0]"] ],
[ "Lvls"		, "ADBE Easy Levels2"	, "fx" ],
[ "Huesat"		, "ADBE HUE SATURATION"	, "fx" ],
[ "Curves"		, "ADBE CurvesCustom"	, "fx" ],
[ "Invert"		, "ADBE Invert"	, "fx" ] 
];






{
	var panel;
	
	function bernieShelf(thisObj) {
		panel = (thisObj instanceof Panel) ? thisObj : new Window("palette", "bernieShelf", [100, 100, 300, 300],{resizeable:true});
		var res = 			
		"group { \
			alignment: ['fill','fill'], \
			alignChildren: ['fill','top'], \
			}";		
		group = panel.add(res);
		addButtons(group);
		resfreshUI(panel);
		return panel;
		
	}

    function parseTest(myvar){
        myvar += "Myvar";
        d(myvar);
        return myvar
    }

	function addButtons(src){
        // https://community.adobe.com/t5/after-effects-discussions/addeventlistener-click-problem/m-p/10817469
		for( i = 0 ; i < simpleEffects.length; i++){
			d(simpleEffects[i][0]);
			btn = src.add("button", undefined, simpleEffects[i][0]);
            btn.data = simpleEffects[i];
			//src.add ("statictext", [5,5,5,5], '_');
            btn.onClick = function (e){
                shift = (ScriptUI.environment.keyboardState.shiftKey)?'shift On':'shift Off';
                
                d(this.data[1]+' '+shift);
            };
            //btn.addEventListener('mousedown',function(){
            //    shift = (ScriptUI.environment.keyboardState.shiftKey)?'shift On':'shift Off';
            //   d('test'+shift);
            //});
            myWin.upBtn = src.add ( "iconbutton", undefined, "SourceFolderIcon" );
			//btn.onClick = function(){
			//	alert(simpleEffects[i][0].toString());
				//e( 'Btn' + simpleEffects[i][0].toString() );
				//e( ();
				//alert(simpleEffects[i][0]);
			//}
		}
	}

	function resfreshUI(src){
		src.layout.layout(true);
		src.layout.resize();
		src.onResizing = src.onResize = function () {
			g = src.children[0];

			//d(g.orientation);

			if(src.size[0]>src.size[1]){
				src.orientation = 'column';
				g.orientation = 'row';
			}else{
				src.orientation = 'row';
				g.orientation = 'column';	
			}
			src.layout.layout(true);
			this.layout.resize();
			
			}
		

	}


	bernieShelf(this);
}