Sorry, possibly oversight on my part. Does this work better? var originalRulerUnits = app.preferences.rulerUnits; app.preferences.rulerUnits = Units.PIXELS; var originalDoc = app.documents.getByName("original.psd"); var tileDoc = app.documents.getByName("tile.jpg"); var theTileLayer = tileDoc.layers.getByName("Background"); var theCopiedTile = theTileLayer.duplicate(originalDoc.layerSets.getByName("flooring"), ElementPlacement.PLACEATBEGINNING); app.activeDocument = originalDoc; theCopiedTile.name = "tile"; var theBounds = theCopiedTile.bounds; theCopiedTile.translate(theBounds[0]*(-1), theBounds[1]*(-1)); app.preferences.rulerUnits = originalRulerUnits; This would probably take longer but you could also use originalDoc.selection.selectAll(); originalDoc.activeLayer = theCopiedTile; // Layer-TopEdges,Layer/TopEdges,Top Edges,Layer > Align > Top Edges,Align the top edges of the selected layers, var id853 = charIDToTypeID( "Algn" ); var desc167 = new ActionDescriptor(); var id854 = charIDToTypeID( "null" ); var ref126 = new ActionReference(); var id855 = charIDToTypeID( "Lyr " ); var id856 = charIDToTypeID( "Ordn" ); var id857 = charIDToTypeID( "Trgt" ); ref126.putEnumerated( id855, id856, id857 ); desc167.putReference( id854, ref126 ); var id858 = charIDToTypeID( "Usng" ); var id859 = charIDToTypeID( "ADSt" ); var id860 = charIDToTypeID( "AdTp" ); desc167.putEnumerated( id858, id859, id860 ); executeAction( id853, desc167, DialogModes.ALL ); // Layer-LeftEdges,Layer/LeftEdges,Left Edges,Layer > Align > Left Edges,Align the left edges of the selected layers, var id877 = charIDToTypeID( "Algn" ); var desc170 = new ActionDescriptor(); var id878 = charIDToTypeID( "null" ); var ref129 = new ActionReference(); var id879 = charIDToTypeID( "Lyr " ); var id880 = charIDToTypeID( "Ordn" ); var id881 = charIDToTypeID( "Trgt" ); ref129.putEnumerated( id879, id880, id881 ); desc170.putReference( id878, ref129 ); var id882 = charIDToTypeID( "Usng" ); var id883 = charIDToTypeID( "ADSt" ); var id884 = charIDToTypeID( "AdLf" ); desc170.putEnumerated( id882, id883, id884 ); executeAction( id877, desc170, DialogModes.ALL );
... View more