// remember old tool
var r = new ActionReference();
r.putProperty(stringIDToTypeID("property"), stringIDToTypeID("tool"));
r.putEnumerated(stringIDToTypeID("application"), stringIDToTypeID("ordinal"), stringIDToTypeID("targetEnum"));
var curr_tool = executeActionGet(r).getEnumerationType(stringIDToTypeID("tool"));
// select eyedropper tool
var r = new ActionReference();
r.putClass(stringIDToTypeID("eyedropperTool"));
var d = new ActionDescriptor();
d.putReference(stringIDToTypeID("null"), r);
executeAction(stringIDToTypeID("select"), d, DialogModes.NO);
// get and set eyedropper tool options
var r = new ActionReference();
r.putProperty(stringIDToTypeID("property"), stringIDToTypeID("tool"));
r.putEnumerated(stringIDToTypeID("application"), stringIDToTypeID("ordinal"), stringIDToTypeID("targetEnum"));
var op = executeActionGet(r).getObjectValue(stringIDToTypeID("currentToolOptions"));
op.putInteger(stringIDToTypeID("eyeDropperSample"), 0); // point sample
op.putInteger(stringIDToTypeID("eyeDropperSampleSheet"), 1); // current layer
var r = new ActionReference();
r.putClass(stringIDToTypeID("eyedropperTool"));
var d = new ActionDescriptor();
d.putReference( stringIDToTypeID( "null" ), r );
d.putObject(stringIDToTypeID("to"), stringIDToTypeID("null"), op);
executeAction(stringIDToTypeID("set"), d, DialogModes.NO);
// select old tool
var r = new ActionReference();
r.putClass(curr_tool);
var d = new ActionDescriptor();
d.putReference(stringIDToTypeID("null"), r);
executeAction(stringIDToTypeID("select"), d, DialogModes.NO);