• Global community
    • Language:
      • Deutsch
      • English
      • Español
      • Français
      • Português
  • 日本語コミュニティ
    Dedicated community for Japanese speakers
  • 한국 커뮤니티
    Dedicated community for Korean speakers
Exit
1

Paste in place script

Engaged ,
Oct 25, 2022 Oct 25, 2022

Copy link to clipboard

Copied

Long time Photoshop scripter, first time Illustrator scripting.

 

I'm trying to paste an object in place. I would expect there to a method that's similiar to "paste"

app.pasteInPlace(); // won't work
app.paste.inPlace(); // and neither does this

...or something similar.

I've used the work around of 

app.executeMenuCommand("pasteInPlace");

My question is this: Is there a dot method way of pasting in place which has eluded me? Ive checked Illustrator JavaScript Scripting Reference, but that only has 2 references to paste. That would seem more programatical then relying on macros of menu commands.

TOPICS
Scripting

Views

663

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Adobe
Community Expert ,
Oct 25, 2022 Oct 25, 2022

Copy link to clipboard

Copied

app.paste() is all we have. Other than using pasteInPlace menu command, the other alternative is to use duplicate() and reposition, which is more work. Or moving the view, which is also more work.

 

What are you trying to do? paste into different artboards?

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Engaged ,
Oct 25, 2022 Oct 25, 2022

Copy link to clipboard

Copied

Write a two line script (copy & paste in place) as a duplicate subsitute, to put on a keyboard shortcut.

 

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Community Expert ,
Oct 25, 2022 Oct 25, 2022

Copy link to clipboard

Copied

Try this for the script:

 

for (var i = app.selection.length - 1; i >= 0; i--)
    app.selection[i].duplicate();

 

 - Mark

 

Edit: if you want just the duplicate item(s) selected:

for (var i = app.selection.length - 1; i >= 0; i--) {
    app.selection[i].duplicate();
    app.selection[i].selected = false;
}

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Community Expert ,
Oct 25, 2022 Oct 25, 2022

Copy link to clipboard

Copied

I would go with this then. There's nothing wrong with using Menu Commands

app.executeMenuCommand("copy");
app.executeMenuCommand("pasteInPlace");

 

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Community Expert ,
Oct 25, 2022 Oct 25, 2022

Copy link to clipboard

Copied

Succinct and to the point! 🙂

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Community Expert ,
Oct 25, 2022 Oct 25, 2022

Copy link to clipboard

Copied

right?!

 

(we might be missing something though)

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Engaged ,
Oct 26, 2022 Oct 26, 2022

Copy link to clipboard

Copied

I already have a two line script. - That wasn't what I was after.

	app.copy();
	app.executeMenuCommand("pasteInPlace");

 

I would apologise for the confusion, but I'm Autistic and written communication is just another way for me to be misheard or mis-understood. 

 

I just find it very odd that Illustrator scripting seems to lack basic functionality at a low level. - Which is blatanly obvious even from teh two lines above. 

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Community Expert ,
Oct 26, 2022 Oct 26, 2022

Copy link to clipboard

Copied

Yep communication is *hard*. Maybe it would help if you explained your desired workflow. From what I understand so far you are just trying to cut two key combos (copy and paste-in-front) down to one. Is that right? But you have a working script already so I'm confused. If we are missing the point please let us know.

- Mark

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Community Expert ,
Oct 26, 2022 Oct 26, 2022

Copy link to clipboard

Copied

ok no worries, what are you after then?

 

you're not wrong, Illustrator does lack in some areas, just keep in mind that not everything available in the user interface can be scripted. And don't worry about your script being 2 lines or 100 lines.

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
New Here ,
Mar 30, 2024 Mar 30, 2024

Copy link to clipboard

Copied

LATEST

[EDIT]

[ script removed as it is not relevant to illustrator ]

 

[ post again if you have an actual Illustrator Scripting question ]

 

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines