Код:
#target Illustrator
swatchesAction()
function swatchesAction() {
var ActionString = "/version 3\
/name [ 16\
53637269707465645f616374696f6e73\
]\
/isOpen 1\
/actionCount 1\
/action-1 {\
/name [ 12\
52656d6f7665556e75736564\
]\
/keyIndex 0\
/colorIndex 0\
/isOpen 1\
/eventCount 2\
/event-1 {\
/useRulersIn1stQuadrant 0\
/internalName (ai_plugin_swatches)\
/localizedName [ 8\
5377617463686573\
]\
/isOpen 1\
/isOn 1\
/hasDialog 0\
/parameterCount 1\
/parameter-1 {\
/key 1835363957\
/showInPalette 4294967295\
/type (enumerated)\
/name [ 17\
53656c65637420416c6c20556e75736564\
]\
/value 11\
}\
}\
/event-2 {\
/useRulersIn1stQuadrant 0\
/internalName (ai_plugin_swatches)\
/localizedName [ 8\
5377617463686573\
]\
/isOpen 1\
/isOn 1\
/hasDialog 1\
/showDialog 0\
/parameterCount 1\
/parameter-1 {\
/key 1835363957\
/showInPalette 4294967295\
/type (enumerated)\
/name [ 15\
44656c657465205377617463686573\
]\
/value 3\
}\
}\
}";
createAction(ActionString);
var ActionString = null;
runAction("RemoveUnused", "Scripted_actions");
unloadAction ("Scripted_actions", "")
}
function runAction (action, set) {
var myScriptString = "app.doScript('"+action+"', '"+set+"')";
var bt = new BridgeTalk;
bt.target = "illustrator";
bt.body = myScriptString;
bt.send();
};
function loadAction (af) {
var myScriptString = "app.loadAction(af)";
var bt = new BridgeTalk;
bt.target = "illustrator";
bt.body = myScriptString;
bt.send();
};
function unloadAction (set, action) {
var myScriptString = "app.doScript('"+set+"', '"+action+"')";
var bt = new BridgeTalk;
bt.target = "illustrator";
bt.body = myScriptString;
bt.send();
};
function createAction(str) {
var f = new File('~/ScriptAction.aia');
f.open('w');
f.write(str);
f.close();
loadAction (f)
f.remove();
};