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

app.copy(); app.paste(); doesn't work perfectly.

Explorer ,
Aug 24, 2023 Aug 24, 2023

Copy link to clipboard

Copied

What could be causing app.copy(); app.paste(); to not work perfectly in the script below?
The R-letter is missing when copying and pasting.
It works fine when I copy and paste in the app and not in the script.
 
function load(url) {
    var loadFile;
    loadFile = new File(url);
    doc = app.open(loadFile);
    doc.rulerOrigin = [0, 0];
}
load("C:/podContents/illustrator_error/tshirt0.ai");
var layer = doc.layers[0];
var gItem = layer.groupItems[0];
doc.selection = gItem;
app.copy();
app.paste();
 
 
2002854_0-1692864519359.png

 

 
TOPICS
Scripting

Views

196

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
Explorer ,
Aug 24, 2023 Aug 24, 2023

Copy link to clipboard

Copied

The reason we need copy and paste is because we want to copy from the original file and then open another document to paste it into.

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
Explorer ,
Aug 24, 2023 Aug 24, 2023

Copy link to clipboard

Copied

I solved it.

 

function load(url) {
    var loadFile;
    loadFile = new File(url);
    doc = app.open(loadFile);
    doc.rulerOrigin = [0, 0];
}

load("C:/podContents/illustrator_error/tshirt0.ai");

var layer = doc.layers[0];
var gItem = layer.groupItems[0];
doc.selection = gItem;

var emptyDoc = app.documents.add(DocumentColorSpace.RGB, 714.8721 , 1716.4345 );
var copied = gItem.duplicate(emptyDoc);

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 ,
Aug 24, 2023 Aug 24, 2023

Copy link to clipboard

Copied

LATEST

Nice! Well done. 

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 ,
Aug 24, 2023 Aug 24, 2023

Copy link to clipboard

Copied

Hi @은정주2002854, sorry I don't know why the R isn't being copy/pasted. However, I would recommend if you can use PageItem.duplicate() instead. This is a better options because it doesn't need to disturb the clipboard.

- Mark

 

var dup = gItem.duplicate(myLayerInOtherDocument, ElementPlacement.INSIDE);

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
Explorer ,
Aug 24, 2023 Aug 24, 2023

Copy link to clipboard

Copied

Thank you for your reply.

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