SuperMerlin escreveu I wish I knew, I have tried but failed to get it to the top, maybe someone can help with this? I was able to align the thumbnail to the top thanks to an article on page 69 of this manual: http://www.kahrel.plus.com/indesign/scriptui.html Just add this script to line 3 Image.prototype.onDraw = function() { if (!this.image) return; var WH = this.size, wh = this.image.size, k = Math.min(WH[0] / wh[0], WH[1] / wh[1]), xy; //Resize proportionally: wh = [k * wh[0], k * wh[1]]; //Align image xy = [(WH[0] - wh[0]) / 2, (WH[1] - wh[1]) /90]; this.graphics.drawImage(this.image, xy[0], xy[1], wh[0], wh[1]); WH = wh = xy = null; } With some adjustments I was able to line up at the top. #target photoshop; app.bringToFront(); Image.prototype.onDraw = function() { if (!this.image) return; var WH = this.size, wh = this.image.size, k = Math.min(WH[0] / wh[0], WH[1] / wh[1]), xy; //Resize proportionally: wh = [k * wh[0], k * wh[1]]; //Align image xy = [(WH[0] - wh[0]) / 2, (WH[1] - wh[1]) /90]; this.graphics.drawImage(this.image, xy[0], xy[1], wh[0], wh[1]); WH = wh = xy = null; } if(documents.length) main(); function main(){ var OutputFolder =Folder(Folder.temp); if(!OutputFolder.exists) OutputFolder.create(); var LayerName = activeDocument.activeLayer.name; dupLayers(); app.activeDocument.trim(TrimType.TRANSPARENT); var saveFile = File(OutputFolder + "/temp.png"); if(activeDocument.width > activeDocument.height){ activeDocument.resizeImage(UnitValue(150, "px"), undefined, undefined, ResampleMethod.BICUBIC); //196 x 235 }else{ activeDocument.resizeImage(undefined,UnitValue(227, "px"), undefined, ResampleMethod.BICUBIC); } SavePNG(saveFile); app.activeDocument.close(SaveOptions.DONOTSAVECHANGES); Dlg=new Window("dialog","My Dialog",[0,0,250,350],{closeButton: true}); View=Dlg.add("panel",[20,20,230,270]); Thub=View.add("panel",[10,10,196,239]); Thub.graphics.backgroundColor = Thub.graphics.newBrush (Thub.graphics.BrushType.SOLID_COLOR,[0.75,0.75,0.75]); Thu_layer_image = Thub.add ("image", [-2,-5,185,233], File (saveFile)); Thu_layer_image.graphics.foregroundColor = Thu_layer_image.graphics.newPen (Thu_layer_image.graphics.PenType.SOLID_COLOR,[0,0,0], 1); nm_lay=Dlg.add("statictext",[20,290,85,310] ,"ID Layer",{multiline:true}); id_lay=Dlg.add("edittext",[85,287,225,307] ,LayerName," Active Layer"); Dlg.center(); Dlg.show(); } function SavePNG(saveFile){ pngSaveOptions = new PNGSaveOptions(); activeDocument.saveAs(saveFile, pngSaveOptions, true, Extension.LOWERCASE); } function dupLayers() { var desc143 = new ActionDescriptor(); var ref73 = new ActionReference(); ref73.putClass( charIDToTypeID('Dcmn') ); desc143.putReference( charIDToTypeID('null'), ref73 ); desc143.putString( charIDToTypeID('Nm '), activeDocument.activeLayer.name ); var ref74 = new ActionReference(); ref74.putEnumerated( charIDToTypeID('Lyr '), charIDToTypeID('Ordn'), charIDToTypeID('Trgt') ); desc143.putReference( charIDToTypeID('Usng'), ref74 ); executeAction( charIDToTypeID('Mk '), desc143, DialogModes.NO ); }
... View more