#target Illustrator
var doc = app.activeDocument;
var arrowStat = "[None]";
var arrowEnd = "Arrow 1";
var arrowStatScale = 100.0;
var arrowEndScale = 100.0;
strokeWidth = 0.2;
var line_G = doc.pathItems.add();
line_G.setEntirePath([[0, -20], [100, -20]]);
line_G.selected = true;
selectedStrokeArrow(arrowStat, arrowEnd, arrowStatScale, arrowEndScale, strokeWidth);
line_G.strokeOverprint = true;
//Операция и ее запуск
function selectedStrokeArrow(arrowStatName, arrowEndName, arrowStatScale, arrowEndScale, strokeWidth) {
start = ascii2Hex(arrowStatName);
end = ascii2Hex(arrowEndName);
var ActionString = ['/version 3',
'/name [ 9',
' 536372697074536574',
']',
'/isOpen 1',
'/actionCount 1',
'/action-1 {',
' /name [ 12',
' 536372697074416374696f6e',
' ]',
' /keyIndex 0',
' /colorIndex 0',
' /isOpen 1',
' /eventCount 1',
' /event-1 {',
' /useRulersIn1stQuadrant 0',
' /internalName (ai_plugin_setStroke)',
' /localizedName [ 10',
' 536574205374726f6b65',
' ]',
' /isOpen 1',
' /isOn 1',
' /hasDialog 0',
' /parameterCount 12',
' /parameter-1 {',
' /key 2003072104',
' /showInPalette -1',
' /type (unit real)',
' /value ' + strokeWidth,
' /unit 592476268',
' }',
' /parameter-2 {',
' /key 1667330094',
' /showInPalette -1',
' /type (enumerated)',
' /name [ 8',
' 4275747420436170',
' ]',
' /value 0',
' }',
' /parameter-3 {',
' /key 1836344690',
' /showInPalette -1',
' /type (real)',
' /value 10.0',
' }',
' /parameter-4 {',
' /key 1785686382',
' /showInPalette -1',
' /type (enumerated)',
' /name [ 10',
' 4d69746572204a6f696e',
' ]',
' /value 0',
' }',
' /parameter-5 {',
' /key 1684825454',
' /showInPalette -1',
' /type (integer)',
' /value 0',
' }',
' /parameter-6 {',
' /key 1684104298',
' /showInPalette -1',
' /type (boolean)',
' /value 0',
' }',
' /parameter-7 {',
' /key 1634231345',
' /showInPalette -1',
' /type (ustring)',
' /value [ ' + start.length / 2,
' ' + start,
' ]',
' }',
' /parameter-8 {',
' /key 1634231346',
' /showInPalette -1',
' /type (ustring)',
' /value [ ' + end.length / 2,
' ' + end,
' ]',
' }',
' /parameter-9 {',
' /key 1634951985',
' /showInPalette -1',
' /type (real)',
' /value ' + arrowStatScale,
' }',
' /parameter-10 {',
' /key 1634951986',
' /showInPalette -1',
' /type (real)',
' /value ' + arrowEndScale,
' }',
' /parameter-11 {',
' /key 1634230636',
' /showInPalette -1',
' /type (enumerated)',
' /name [ 15',
' 546970204174205061746820456e64',
' ]',
' /value 0',
' }',
' /parameter-12 {',
' /key 1634494318',
' /showInPalette -1',
' /type (enumerated)',
' /name [ 6',
' 43656e746572',
' ]',
' /value 0',
' }',
' }',
'}'].join('\n');
redraw();
var f = new File('~/ScriptAction.aia');
f.open('w');
f.write(ActionString);
f.close();
loadAction(f);
f.remove();
var myScriptString = ['redraw();',
'app.doScript("ScriptAction", "ScriptSet");',
'unloadAction("ScriptSet", "");',
].join('\n');
var bt = new BridgeTalk;
bt.target = "illustrator";
bt.body = myScriptString;
bt.send();
ActionString = null;
};
function ascii2Hex(hex) {
return hex.replace(/./g, function (a) { return a.charCodeAt(0).toString(16) });
};