open as linked smart object
Hello,
iam looking for a solution to open files in a folder
and copy then into a document.
Its working good, but i need the files to be linked smart object.
Anyone knows a solution ?
Here my Code so far:
See in line 33. Convert to smart object: ?
var file = new File('C:/User_MY PATH.PSD'),
docRef = open(file);
// Use the path to the application and append the samples folder
var samplesFolder = Folder('C:/USERS_MY FOLDER');
//Get all the files in the folder
var fileList = samplesFolder.getFiles()
// open each file
for (var i = 0; i < fileList.length; i++)
{
// The fileList is folders and files so open only files
if (fileListinstanceof File)
{
open(fileList)
// use the document name for the layer name in the merged document
var activeDocName = app.activeDocument.name;
var targetDocName = activeDocName.substring(0, activeDocName.lastIndexOf("."));
// Copy the Document
app.activeDocument.selection.selectAll()
//convertToSmartObject(); THIS ISNT WORKING - CONVERT IT ?
app.activeDocument.selection.copy()
// don’t save anything we did
app.activeDocument.close(SaveOptions.DONOTSAVECHANGES)
//Select specific layer to paste the copy, this is to make sure the layers are in a specific position
var doc = app.activeDocument;
doc.activeLayer = doc.artLayers.getByName("bgr");
//Paste Document
app.activeDocument.paste()
app.activeDocument.activeLayer.name = targetDocName
}
};
