上下左右が1px大きくなる。場合によっては2pxのときも。うーん。。。
上下左右が1px大きくなる。場合によっては2pxのときも。うーん。。。
//アクティブドキュメント取得var doc = activeDocument;//アクティブレイヤーvar act = doc.activeLayer;if(act.typename != 'LayerSet'){alert('レイヤーグループを選択してください');} else {//幅とか高さとかvar x = act.bounds[0]; //左var y = act.bounds[1]; //上var x2 = act.bounds[2]; //右下xvar y2 = act.bounds[3]; //右下y//スライス作成// =======================================================var idMk = charIDToTypeID( "Mk " );var desc3 = new ActionDescriptor();var idnull = charIDToTypeID( "null" );var ref1 = new ActionReference();var idslice = stringIDToTypeID( "slice" );ref1.putClass( idslice );desc3.putReference( idnull, ref1 );var idUsng = charIDToTypeID( "Usng" );var desc4 = new ActionDescriptor();var idType = charIDToTypeID( "Type" );var idsliceType = stringIDToTypeID( "sliceType" );var iduser = stringIDToTypeID( "user" );desc4.putEnumerated( idType, idsliceType, iduser );var idAt = charIDToTypeID( "At " );var desc5 = new ActionDescriptor();var idTop = charIDToTypeID( "Top " );var idPxl = charIDToTypeID( "#Pxl" );desc5.putUnitDouble( idTop, idPxl, y );var idLeft = charIDToTypeID( "Left" );var idPxl = charIDToTypeID( "#Pxl" );desc5.putUnitDouble( idLeft, idPxl, x );var idBtom = charIDToTypeID( "Btom" );var idPxl = charIDToTypeID( "#Pxl" );desc5.putUnitDouble( idBtom, idPxl, y2 );var idRght = charIDToTypeID( "Rght" );var idPxl = charIDToTypeID( "#Pxl" );desc5.putUnitDouble( idRght, idPxl, x2 );var idRctn = charIDToTypeID( "Rctn" );desc4.putObject( idAt, idRctn, desc5 );var idslice = stringIDToTypeID( "slice" );desc3.putObject( idUsng, idslice, desc4 );executeAction( idMk, desc3, DialogModes.NO );}