Copy link to clipboard
Copied
Hello!!
It will make a script difficult to ask for help.
1. Select and copy all the images in the document AAA.ai.
2. Paste the BBB.ai document.
3. However, the image of AAA and BBB are located must be the same.
It is difficult to equalize the position of the image.
Please help me.
var inputFolderPath = null;
var totalFilesConverted = 0;
var inputFolderPath = new Folder(Folder.selectDialog('AAA folder select.'));
var inputFolderPath2 = new Folder(Folder.selectDialog('BBB folder select.'));
var testFiles = inputFolderPath.getFiles("*.ai");
var testFiles2 = inputFolderPath2.getFiles("*.ai");
try{
for (d = 0; d < testFiles.length;d++)
{
var docRef = app.open(testFiles
var doc = docRef.activeLayer;
var docName = docRef.name;
var newGroup = doc.groupItems.add();
for (var i = doc.pageItems.length-1; i >= 0; i--) {
var p = doc.pageItems;
if(p.guides != true&&p.typename != "TextFrame")
{
p.selected =true;
}
}
var selectedObject = docRef.selection;
app.copy();
var docRef2 = app.open(new File(inputFolderPath2 + "/" + docName));
var doc2 = docRef2.activeLayer;
for (var i = doc2.pageItems.length-1; i >= 0; i--) {
var p2 = doc2.pageItems;
if(p2.guides != true&&p2.typename != "TextFrame")
{
p2.selected =true;
}
}
if ( docRef2.selection.length > 0 ) {
for (var i = selection.length-1; i >= 0; i--) {
selection.remove();
}
}
app.paste();
docRef2.save();
}
}
catch(e) {
alert(e);}
alert('OK');
Copy link to clipboard
Copied
If I understand the question, instead
app.paste ();
can be used
executeMenuCommand ('pasteFront');
or
executeMenuCommand ('pasteInPlace');
Compatible CS6+
Copy link to clipboard
Copied
Find more inspiration, events, and resources on the new Adobe Community
Explore Now