Hellos, After getting stuck with a masking issue and illustrators scripting methods not giving me hope, i was shown the post for creating your own Actions Scripts Don't Move Opacity Masks Using Silly-V's answer i have made some helpful lil things to create/remove dynamic actions with multiple events when you need them that i thought people might want to use: ActionSet.js function ActionSet() { //Init vars this.version = 3; this.events = []; //Create action header this.createHeader = function() { return [ "/version " + this.version, "/name [ 10", " 44796e616d6963536574", "]", " /isOpen 0", " /actionCount 1", " /action-1 {", " /name [ 13 44796e616d6963416374696f6e ]", " /keyIndex 0", " /colorIndex 0", " /isOpen 0", " /eventCount " + this.events.length ]; }; //Add event to array this.addEvent = function(event) { this.events.push(event.join("\n")); }; //Compile all the events into an action string this.compileAction = function() { var events = this.events; if (events.length > 0) { //Create header var str = this.createHeader(); //Add actions for (var i = 0; i < events.length; i++) { str.push(" /event-" + (i + 1) + " {"); str.push(events); str.push("}"); } str.push("}"); //Join and return this.action = str.join("\n"); return this.action; } }; this.loadAction = function() { aiaFile = new File('~/DynamicAction.aia'); aiaFile.open("w"); aiaFile.write(this.action); aiaFile.close(); app.loadAction(aiaFile); aiaFile.remove(); }; this.execute = function() { //Compile this.compileAction(); //Load into AI this.loadAction(); //Run action app.doScript("DynamicAction", "DynamicSet"); //Remove from AI app.unloadAction("DynamicSet", ""); }; } Actions.js: function Actions() { } Actions.prototype = { align : { vertical : { top : function() { return alignEvent("18 566572746963616c20416c69676e20546f70", "4"); }, bottom : function() { return alignEvent("21 566572746963616c20416c69676e20426f74746f6d", "6"); }, center : function() { return alignEvent("21 566572746963616c20416c69676e2043656e746572", "5"); } }, horizontal : { left : function() { return alignEvent("21 486f72697a6f6e74616c20416c69676e204c656674", "1"); }, right : function() { return alignEvent("22 486f72697a6f6e74616c20416c69676e205269676874", "3"); }, center : function() { return alignEvent("23 486f72697a6f6e74616c20416c69676e2043656e746572", "2"); } } }, transform : { move : function(horizontal, vertical, copy) { return move(horizontal, vertical, copy); }, rotate : function(angle, copy) { return rotate(angle, copy); }, reflect : function(angle, copy) { return reflect(angle, copy); } }, pathfinder : { divide : function() { return pathFinderEvent("6 446976696465", "5"); }, trim : function() { return pathFinderEvent("4 5472696d", "7"); }, merge : function() { return pathFinderEvent("5 4d65726765", "8"); }, crop : function() { return pathFinderEvent("4 43726f70", "9"); }, outline : function() { return pathFinderEvent("7 4f75746c696e65", "6"); }, minusBlack : function() { return pathFinderEvent("10 4d696e7573204261636b", "4"); } }, selection : { all : function() { return selectAll(); } } }; /* * Selection */ function selectAll() { return [ "/useRulersIn1stQuadrant 0", "/internalName (adobe_selectAll)", "/localizedName [ 10 53656c65637420416c6c ]", "/isOpen 0", "/isOn 1", "/hasDialog 0", "/parameterCount 0", ]; } /* * Align */ function alignEvent(hex, value) { return [ "/useRulersIn1stQuadrant 0", "/internalName (ai_plugin_alignPalette)", "/localizedName [ 9 416c69676e6d656e74 ]", //Alignment "/isOpen 0", "/isOn 1", "/hasDialog 0", "/parameterCount 1", "/parameter-1 {", "/key 1954115685", "/showInPalette 4294967295", "/type (enumerated)", "/name [ " + hex + " ]", //Horizontal Align Center "/value " + value, "}" ]; } /* * Transform */ function move(horizontal, vertical, copy) { return [ " /useRulersIn1stQuadrant 0", " /internalName (adobe_move)", " /localizedName [ 4 4d6f7665 ]", //Move " /isOpen 0", " /isOn 1", " /hasDialog 1", " /showDialog 0", " /parameterCount 3", " /parameter-1 {", //Horizontal " /key 1752136302", " /showInPalette 4294967295", " /type (unit real)", " /value " + horizontal + (horizontal.toString().indexOf(".") == -1 ? ".0" : ""), " /unit 592476268", " }", " /parameter-2 {", //Vertical " /key 1987339116", " /showInPalette 4294967295", " /type (unit real)", " /value " + vertical + (vertical.toString().indexOf(".") == -1 ? ".0" : ""), //Distance " /unit 592476268", " }", " /parameter-3 {", //Copy " /key 1668247673", " /showInPalette 4294967295", " /type (boolean)", " /value " + (copy ? 1 : 0), //0 - No, 1 - Yes " }" ]; } function rotate(angle, copy) { return [ //Action - Rotate " /useRulersIn1stQuadrant 0", " /internalName (adobe_rotate)", " /localizedName [ 6 526f74617465 ]", //Rotate " /isOpen 0", " /isOn 1", " /hasDialog 1", " /showDialog 0", " /parameterCount 2", " /parameter-1 {", //Angle " /key 1634625388", " /showInPalette 4294967295", " /type (unit real)", " /value " + angle + (angle.toString().indexOf(".") == -1 ? ".0" : ""), " /unit 591490663", " }", " /parameter-2 {", //Copy " /key 1668247673", " /showInPalette 4294967295", " /type (boolean)", " /value " + (copy ? 1 : 0), //0 - No, 1 - Yes " }" ]; } function reflect(angle, copy) { return [ "/useRulersIn1stQuadrant 0", "/internalName (adobe_reflect)", "/localizedName [ 7 5265666c656374 ]", //Reflect "/isOpen 0", "/isOn 1", "/hasDialog 1", "/showDialog 0", "/parameterCount 2", "/parameter-1 {", "/key 1634625388", "/showInPalette 4294967295", "/type (unit real)", "/value " + angle + (angle.toString().indexOf(".") == -1 ? ".0" : ""), // Angle "/unit 591490663", "}", "/parameter-2 {", "/key 1668247673", "/showInPalette 4294967295", "/type (boolean)", " /value " + (copy ? 1 : 0), //0 - No, 1 - Yes "}" ]; } /* * Path Finder */ function pathFinderEvent(hex, value) { return [ "/useRulersIn1stQuadrant 0", "/internalName (ai_plugin_pathfinder)", "/localizedName [ 10 5061746866696e646572 ]", //Pathfinder "/isOpen 0", "/isOn 1", "/hasDialog 0", "/parameterCount 1", "/parameter-1 {", "/key 1851878757", "/showInPalette 4294967295", "/type (enumerated)", "/name [ " + hex + " ]", "/value " + value, "}" ]; } Example: #include 'actions/ActionSet.js'; #include 'actions/Actions.js'; /* * Test Script */ testAction(); function testAction() { try { var set = new ActionSet(); var actions = new Actions(); //Transform set.addEvent(actions.transform.move(100, 100, false)); set.addEvent(actions.transform.rotate(90, false)); set.addEvent(actions.transform.reflect(90, false)); //Align - Horizontal set.addEvent(actions.align.horizontal.right()); set.addEvent(actions.align.horizontal.left()); set.addEvent(actions.align.horizontal.center()); //Align - Vertical set.addEvent(actions.align.vertical.top()); set.addEvent(actions.align.vertical.bottom()); set.addEvent(actions.align.vertical.center()); //PathFinder set.addEvent(actions.pathfinder.divide()); set.addEvent(actions.pathfinder.trim()); set.addEvent(actions.pathfinder.merge()); set.addEvent(actions.pathfinder.crop()); set.addEvent(actions.pathfinder.outline()); set.addEvent(actions.pathfinder.minusBlack()); //Execute event set.execute(); } catch (e) { alert(e); } } Lil vid Gyazo - e548a1d14aa4434a91efc9b10161c38e.gif If you want learn more about actions, have a gander at: Creating a dynamic action to use with app.doScript() method. written by Silly-V​
... View more