[Q] Setting "Tolerance' value for Magic Wand Tool with Humanizer.playObject()
naokihada opened this issue · 0 comments
naokihada commented
Hi @jardicc
Thank you very much for making available this library. It is very helpful and I'm using my project.
I got know how to use for reading part, but I'm not sure setting part.
Could you tell me how to write objectToPlay part for setting value on Tolarence for Magic Wand Tool case?
I meant to following part on Photoshop UI.
Following code is working to get referenceObject part, but setting (playObject) part is not working.
#target photoshop
#include Humanizer.jsx
// Trying to set Tolerance on Magic Wand Tool
// Select Magic Wand Tool before run script
var referenceObject = {
"null": {
"_ref": [
{
"_property": "tool",
"_ref": "property"
}
,{
"_enum": "ordinal",
"_ref": "application",
"_value": "target"
}
]
}
};
var _obj = Humanizer.getObject(referenceObject);
$.writeln(Humanizer.objectToJsonString(_obj, 4));
$.writeln("===============");
var _opt = _obj.currentToolOptions;
$.writeln(Humanizer.objectToJsonString(_opt, 4));
$.writeln("===============");
_opt["$WndT"] = 55; // Tolerance on Menu bar
var objectToPlay = {
"null": {
"_enum": "ordinal", // I'm not sure this part.
"_ref": "currentToolOptions", // I'm not sure this part.
"_value": "targetEnum" // I'm not sure this part.
},
"to": _opt
}
Humanizer.playObject ("set", objectToPlay); // cause error here
$.writeln("===============");
The console output is following:
===============
{
"_obj": "object",
"currentToolOptions": {
"$WndA": true,
"$WndT": 32,
"_obj": "currentToolOptions",
"contiguous": true,
"eyeDropperSample": 0,
"selectionEnum": 0,
"windowsSystem": false
},
"tool": {
"_enum": "magicWandTool",
"_value": "targetEnum"
}
}
===============
{
"$WndA": true,
"$WndT": 32,
"_obj": "currentToolOptions",
"contiguous": true,
"eyeDropperSample": 0,
"selectionEnum": 0,
"windowsSystem": false
}
===============
Thank you.