That post is enough, I've almost everything ready with adding this options to script, but have some errors with other functions I'm adding right now, thats why I'm not posting any updates.
But if you want you can try this script (paste in notepad and save as jsx file:
[CODE=javascript] var maintainAspectRatio = false;
if(app.documents.length>0){
app.activeDocument.suspendHistory ('Fill Layer on Canvas', 'FillLayerOnCanvas('+maintainAspectRatio+')');
}
function FillLayerOnCanvas( keepAspect ){
var doc = app.activeDocument;
var layer = doc.activeLayer;
var defaultRulerUnits = app.preferences.rulerUnits;
app.preferences.rulerUnits = Units.PIXELS;
var width = doc.width.as('px');
var height =doc.height.as('px');
var bounds = app.activeDocument.activeLayer.bounds;
var layerWidth = bounds[2].as('px')-bounds[0].as('px');
var layerHeight = bounds[3].as('px')-bounds[1].as('px');
layer.translate(new UnitValue(0-layer.bounds[0].as('px'),'px'), new UnitValue(0-layer.bounds[1].as('px'),'px'));
if( !keepAspect ){
layer.resize( (width/layerWidth)*100,(height/layerHeight)*100,AnchorPosition.TOPLEFT);
}else{
var layerRatio = layerWidth / layerHeight;
var newWidth = width;
var newHeight = ((1.0 * width) / layerRatio);
if (newHeight >= height) {
newWidth = layerRatio * height;
newHeight = height;
}
var resizePercent = newWidth/layerWidth*100;
app.activeDocument.activeLayer.resize(resizePercent,resizePercent,AnchorPosition.TOPLEFT);
}
app.preferences.rulerUnits = defaultRulerUnits;
} [/CODE]
Tell me if this is what you need 