Skip to main content
Mattmcquiff
Inspiring
March 30, 2016
Question

Paste into place

  • March 30, 2016
  • 2 replies
  • 448 views

Hi I would like to script the menu item paste special > Paste in place.

as this all allow the clipboard to paste centrally in the active document?

Many Thanks

Matt

This topic has been closed for replies.

2 replies

SuperMerlin
Inspiring
March 30, 2016

app.activeDocument.paste(true);

JJMack
Community Expert
Community Expert
March 30, 2016

Its strange how the human mind works, Well mine anyway.   The op stated menu item which set my mind off too quickly I use paste ture all the time.

For example

var selectedRegion = Array(Array(x,y), Array(x+width,y), Array(x+width,y+height), Array(x,y+height));

doc.selection.select(selectedRegion);

doc.paste(true); //paste image into masked layer your document

doc.activeLayer.name=imageName; //label layer with image file name

doc.selection.select(selectedRegion);

align('AdCH'); align('AdCV'); // center what was pasted its size  could exceed the area the layer mask will mask over size off

doc.selection.deselect();

JJMack
JJMack
Community Expert
Community Expert
March 30, 2016

You may need to use Action manager code to do that use the Scriptlistener plug-in to generate that code. The is also

runMenuItem (menuID) number Run a menu item given the menu ID

I do know how  to get the menuID.....

// =======================================================

var idpast = charIDToTypeID( "past" );

    var desc46 = new ActionDescriptor();

    var idinPlace = stringIDToTypeID( "inPlace" );

    desc46.putBoolean( idinPlace, true );

    var idAntA = charIDToTypeID( "AntA" );

    var idAnnt = charIDToTypeID( "Annt" );

    var idAnno = charIDToTypeID( "Anno" );

    desc46.putEnumerated( idAntA, idAnnt, idAnno );

    var idAs = charIDToTypeID( "As  " );

    var idPxel = charIDToTypeID( "Pxel" );

    desc46.putClass( idAs, idPxel );

executeAction( idpast, desc46, DialogModes.NO );

JJMack