Copy link to clipboard
Copied
hello,
as is shown, how to set the customShapeTool's shape name?
There's a piece of code here that doesn't work,Please help me.
// select tool
var r = new ActionReference();
r.putClass(stringIDToTypeID("customShapeTool"));
var d = new ActionDescriptor();
d.putReference(stringIDToTypeID("null"), r);
executeAction(stringIDToTypeID("select"), d, DialogModes.NO);
// set option
var r = new ActionReference();
r.putProperty(stringIDToTypeID("property"), stringIDToTypeID("tool"));
r.putEnumerated(stringIDToTypeID("application"), stringIDToTypeID("ordinal"), stringIDToTypeID("targetEnum"));
var ret = executeActionGet(r);
var options = ret.getObjectValue(stringIDToTypeID("currentToolOptions"));
var options = options.getObjectValue(stringIDToTypeID("customShape"));
options.putString(stringIDToTypeID("name"),"ç®å¤´ 5");
var r = new ActionReference();
r.putClass(stringIDToTypeID("customShapeTool"));
var d = new ActionDescriptor();
d.putReference(stringIDToTypeID("null"), r);
d.putObject(stringIDToTypeID("to"), stringIDToTypeID("null"), options);
executeAction(stringIDToTypeID("set"), d, DialogModes.NO);
...var r = new ActionReference();
r.putProperty(stringIDToTypeID("property"), stringIDToTypeID("tool"));
r.putEnumerated(stringIDToTypeID("application"), stringIDToTypeID("ordinal"), stringIDToTypeID("targetEnum"));
var options = executeActionGet(r).getObjectValue(stringIDToTypeID("currentToolOptions"));
var d1 = new ActionDescriptor();
d1.putString(stringIDToTypeID("name"),"Arrow 5");
options.putObject(stringIDToTypeID("customShape"), stringIDToTypeID("customShape"), d1);
var r = new Act
Copy link to clipboard
Copied
var r = new ActionReference();
r.putProperty(stringIDToTypeID("property"), stringIDToTypeID("tool"));
r.putEnumerated(stringIDToTypeID("application"), stringIDToTypeID("ordinal"), stringIDToTypeID("targetEnum"));
var options = executeActionGet(r).getObjectValue(stringIDToTypeID("currentToolOptions"));
var d1 = new ActionDescriptor();
d1.putString(stringIDToTypeID("name"),"Arrow 5");
options.putObject(stringIDToTypeID("customShape"), stringIDToTypeID("customShape"), d1);
var r = new ActionReference();
r.putClass(stringIDToTypeID("customShapeTool"));
var d = new ActionDescriptor();
d.putReference(stringIDToTypeID("null"), r);
d.putObject(stringIDToTypeID("to"), stringIDToTypeID("null"), options);
executeAction(stringIDToTypeID("set"), d, DialogModes.NO);
Copy link to clipboard
Copied
thank you ,r-bin,You are a warm-hearted person