Copy link to clipboard
Copied
Is there a way to select mutiple objects in a Illustrator doc and then paste each selection individually in that same file just like selecting and placing mutiple files into an Illustrator doc?
sounds like a data merge workflow/script would solve your problem
here's a basic test case script that will replace placeholder items in Layer 1, with source items in Layer 0 (top layer)
set up you test file like this
the script will match each Layer 1 placeholder item's size and position to each Layer 0 source item, then it will remove the placeholder item
result
// replace placeholder items
// place source items in layer 0
// place placeholder items in layer 1
function main() {
var idoc = app.activeDocument;
var sourceLayer = idoc.layers[0...
Copy link to clipboard
Copied
in the simplest form you can do the following
app.executeMenuCommand('selectall');
app.copy(); //loads content to the clipboard
app.activeDocument = /* select new document here */
app.paste(); //pastes the content
if you want to be more selective for what you copy you would just need to do a loop of content and change their .selected value to true and then copy/paste.
Copy link to clipboard
Copied
It might be worth elaborating on exactly what you want to do @epic_Eclipse6433. Be as specific as you can, and posting a small example document is good too.
Copy link to clipboard
Copied
I think the OP wants to "load" the copied objects to a "Pasting Gun" to click and paste one at a time, similar to the way Placing multiple files works
Copy link to clipboard
Copied
This is exactly what I am wanting to do. "Pasting Gun" is the perfect description. Exactly like Placing multiple files works.
Copy link to clipboard
Copied
can you elaborate on your workflow? why do you need such a feature? since there's no native feature or scripting api for "paste gun" perhaps someone comes up with a different approach to the problem
for example we could do it in reverse.
1. use the Paintbrush Tool (B) to click as if it was your placing gun. The paths created would be used for placement
2. copy the objects you need to place with the gun
3. use a script to place the selected objects at the locations created by the Paintbrush Tool in step 1
Copy link to clipboard
Copied
Carlos,
1. I normally create placeholder icons where I need to paste the objects.
2. I currenlty select one object at a time and move it over to my placeholder icon. (Such a pain)
3. I would like to select multiple objects to copy over and paste each object on the placeholder icon one after another however I have no script to do this.
Think of the workflow like a brick wall where each brick in the wall represents a placeholder icon. Each brick in the wall is a specific size. On a seperate artboard there are 100+ objects that are sized the same as the bricks that make up the wall. I need to select the objects randomly and then paste individulally onto a brick in the wall until all bricks have an object pasted on them. If I had all 100+ objects saved as PDF's or images I could easily go in and select them all by using the Place command and then "paste gun" them on each brick. The objects are different everytime and are rarely individual PDF's or images, hence the problem.
Copy link to clipboard
Copied
sounds like a data merge workflow/script would solve your problem
Copy link to clipboard
Copied
I will look into Data Merge. I tried that once before and it didnt seem to work as it does in InDesign. But I will check it out. Thank you so much for helping. I really appreciate it
Copy link to clipboard
Copied
If you are referring to the way a lot of these clipboard extensions do it: no.
And if you use a clipboard extension (system plugin), then most probably Illustrator will give you a lot of issues.
Copy link to clipboard
Copied
here's a basic test case script that will replace placeholder items in Layer 1, with source items in Layer 0 (top layer)
set up you test file like this
the script will match each Layer 1 placeholder item's size and position to each Layer 0 source item, then it will remove the placeholder item
result
// replace placeholder items
// place source items in layer 0
// place placeholder items in layer 1
function main() {
var idoc = app.activeDocument;
var sourceLayer = idoc.layers[0];
// if first layer is empty, then skip
if (sourceLayer.pageItems.length > 0) {
var sourceItems = sourceLayer.pageItems;
var sourcecount = sourceItems.length;
var placeholderLayer = idoc.layers[1];
var placeholderItems = placeholderLayer.pageItems;
for (var a=sourceItems.length-1; a>=0; a--){
sourceItems[a].width = placeholderItems[a].width;
sourceItems[a].height = placeholderItems[a].height;
sourceItems[a].position = placeholderItems[a].position;
sourceItems[a].move(placeholderLayer, ElementPlacement.PLACEATEND);
}
// REMOVE PREVIOUS PLACEHOLDER ITEMS
for (var b=0; b<sourcecount; b++) {
placeholderLayer.pageItems[0].remove();
}
}
}
main();
Find more inspiration, events, and resources on the new Adobe Community
Explore Now