var w = 1; // px
var tmp = app.preferences.rulerUnits;
app.preferences.rulerUnits = Units.PIXELS;
var x = activeDocument.width.value;
var y = activeDocument.height.value;
app.preferences.rulerUnits = tmp;
var d = new ActionDescriptor();
var r = new ActionReference();
r.putClass(stringIDToTypeID("contentLayer"));
d.putReference(stringIDToTypeID("null"), r);
var d1 = new ActionDescriptor();
d1.putObject(stringIDToTypeID("type"), stringIDToTypeID("solidColorLayer"), new ActionDescriptor());
var d2 = new ActionDescriptor();
d2.putUnitDouble(stringIDToTypeID("top"), stringIDToTypeID("pixelsUnit"), 0);
d2.putUnitDouble(stringIDToTypeID("left"), stringIDToTypeID("pixelsUnit"), 0);
d2.putUnitDouble(stringIDToTypeID("bottom"), stringIDToTypeID("pixelsUnit"), y);
d2.putUnitDouble(stringIDToTypeID("right"), stringIDToTypeID("pixelsUnit"), x);
d1.putObject(stringIDToTypeID("shape"), stringIDToTypeID("rectangle"), d2);
var d2 = new ActionDescriptor();
d2.putBoolean(stringIDToTypeID("strokeEnabled"), true);
d2.putBoolean(stringIDToTypeID("fillEnabled"), false);
d2.putUnitDouble(stringIDToTypeID("strokeStyleLineWidth"), stringIDToTypeID("pixelsUnit"), w);
var d3 = new ActionDescriptor();
d3.putDouble(stringIDToTypeID("red"), 0);
d3.putDouble(stringIDToTypeID("green"), 0);
d3.putDouble(stringIDToTypeID("blue"), 0);
var d4 = new ActionDescriptor();
d4.putObject(stringIDToTypeID("color"), stringIDToTypeID("RGBColor"), d3);
d2.putObject(stringIDToTypeID("strokeStyleContent"), stringIDToTypeID("solidColorLayer"), d4);
d1.putObject(stringIDToTypeID("strokeStyle"), stringIDToTypeID("strokeStyle"), d2);
d.putObject(stringIDToTypeID("using"), stringIDToTypeID("contentLayer"), d1);
executeAction(stringIDToTypeID("make"), d, DialogModes.NO);