====== インデックスからレイヤーを選択するスクリプト ====== function selectLayerByIndex(index,add){ add = (add == undefined) ? add = false : add; var ref = new ActionReference(); ref.putIndex(charIDToTypeID("Lyr "), index); var desc = new ActionDescriptor(); desc.putReference(charIDToTypeID("null"), ref ); if(add) desc.putEnumerated( stringIDToTypeID( "selectionModifier" ), stringIDToTypeID( "selectionModifierType" ), stringIDToTypeID( "addToSelection" ) ); desc.putBoolean( charIDToTypeID( "MkVs" ), false ); try{ executeAction(charIDToTypeID("slct"), desc, DialogModes.NO ); }catch(e){} };