How to set tool options (for example, "Sample" option of eyedropper)

According to this thread, it’s possible to change eyedropper’s option via CEP:

#target photoshop
var s2t = stringIDToTypeID;

(ref = new ActionReference()).putProperty(s2t('property'), p = s2t('tool'));
ref.putEnumerated(s2t('application'), s2t('ordinal'), s2t('targetEnum'));
var cTool = executeActionGet(ref).getEnumerationType(p);

(selectTool = function (tool) {
    (r = new ActionReference()).putClass(tool);
    (d = new ActionDescriptor()).putReference(s2t('target'), r);
    executeAction(s2t('select'), d, DialogModes.NO);

(d = new ActionDescriptor()).putInteger(p = s2t('eyeDropperSampleSheet'),
    executeActionGet(ref).getObjectValue(s2t('currentToolOptions')).getInteger(p) ? 0 : 1);
(r = new ActionReference()).putClass(s2t('eyedropperTool'));
(d1 = new ActionDescriptor()).putReference(s2t('target'), r);
d1.putObject(s2t('to'), s2t('target'), d);
executeAction(s2t('set'), d1, DialogModes.NO);


But how to do this in UXP? Or more generally, how can we find how to do these things? Neither app.eventNotifier or alchemist plugin shows the descriptor when I change eyedropper’s option.

Now I know how to get the property:

      "_obj": "get",
      "_target": [
            "_property": "currentToolOptions"
            "_ref": "application",
            "_enum": "ordinal",
            "_value": "targetEnum"
      "_options": {
         "dialogOptions": "dontDisplay"
   "synchronousExecution": false,
   "modalBehavior": "fail"

However what I want is to set it. I tried every possible combinations that I thought of, but still couldn’t get it to work.

You should be able to figure out by checking the solution of this topic