Last active
December 16, 2015 04:09
-
-
Save rogerclark/5374766 to your computer and use it in GitHub Desktop.
"File > Place" multiple files in Photoshop. The default dialog only allows you to select one file at a time.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
function placeFile(file) | |
{ | |
// this is horrid output from ScriptListener, but it gets the job done. | |
// the app.open() method will only turn PSD files into Smart Objects | |
var idPlc = charIDToTypeID( "Plc " ); | |
var desc2 = new ActionDescriptor(); | |
var idnull = charIDToTypeID( "null" ); | |
desc2.putPath( idnull, file); | |
var idFTcs = charIDToTypeID( "FTcs" ); | |
var idQCSt = charIDToTypeID( "QCSt" ); | |
var idQcsa = charIDToTypeID( "Qcsa" ); | |
desc2.putEnumerated( idFTcs, idQCSt, idQcsa ); | |
var idOfst = charIDToTypeID( "Ofst" ); | |
var desc3 = new ActionDescriptor(); | |
var idHrzn = charIDToTypeID( "Hrzn" ); | |
var idRlt = charIDToTypeID( "#Rlt" ); | |
desc3.putUnitDouble( idHrzn, idRlt, 0.000000 ); | |
var idVrtc = charIDToTypeID( "Vrtc" ); | |
var idRlt = charIDToTypeID( "#Rlt" ); | |
desc3.putUnitDouble( idVrtc, idRlt, 0.000000 ); | |
var idOfst = charIDToTypeID( "Ofst" ); | |
desc2.putObject( idOfst, idOfst, desc3 ); | |
executeAction( idPlc, desc2, DialogModes.NO ); | |
} | |
var files = app.openDialog(); | |
if (files) { | |
for (var i = 0; i < files.length; i++) { | |
placeFile(files[i]); | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment