Direct function for scanning pixels is not in Photoshop.
But you can do something like this.
// click magicwand at point [0,0] px
var d = new ActionDescriptor();
var r = new ActionReference();
r.putProperty(stringIDToTypeID("channel"), stringIDToTypeID("selection"));
d.putReference(stringIDToTypeID("null"), r);
var d1 = new ActionDescriptor();
d1.putUnitDouble(stringIDToTypeID("horizontal"), stringIDToTypeID("pixelsUnit"), 0);
d1.putUnitDouble(stringIDToTypeID("vertical"), stringIDToTypeID("pixelsUnit"), 0);
d.putObject(stringIDToTypeID("to"), stringIDToTypeID("point"), d1);
d.putInteger(stringIDToTypeID("tolerance"), 0);
d.putBoolean(stringIDToTypeID("antiAlias"), false);
d.putBoolean(stringIDToTypeID("merged"), true);
executeAction(stringIDToTypeID("set"), d, DialogModes.NO);
// invert selection
activeDocument.selection.invert();
// create guides
if (preferences.rulerUnits == Units.PERCENT) preferences.rulerUnits = Units.CM;
activeDocument.guides.add(Direction.HORIZONTAL, activeDocument.selection.bounds[1]);
activeDocument.guides.add(Direction.VERTICAL, activeDocument.selection.bounds[0]);
activeDocument.guides.add(Direction.HORIZONTAL, activeDocument.selection.bounds[3]);
activeDocument.guides.add(Direction.VERTICAL, activeDocument.selection.bounds[2]);
// deselect selection
activeDocument.selection.deselect();