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

Error 1200 on app.paste()

Explorer ,
Nov 07, 2022 Nov 07, 2022

Copy link to clipboard

Copied

Good day, 
I recently ran into a problem with Illustrator on one of my machines. I am pasting files into one document and on one of three workstations  Illustrator throws the Error 1200 ( See attached screenshot) while pasting the second file. I already tried some workaround like placing a delay before pasting, closing the SourceDocument after the app.paste() or doing app.redraw(), none of them worked. The only thing that prevents the errror is an allert() before the paste command - which is halting the automatic process. I can't find troubleshootings on this particular issue in google, maybe one of you ran into this or a related issue before and knows a solution. Thanks in advance! 

WIDSnonamer_0-1667813878824.png

 

TOPICS
Bug , Import and export , Performance , Scripting , SDK , Tools

Views

202

Likes

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

correct answers 1 Correct answer

Explorer , Nov 08, 2022 Nov 08, 2022

Destdoc ist a new blank document, but the Error occurs only in the second time Paste is executed - so there ist already content in the document. 

 

But i already got a workaround - before pasting i add a temp pathitem and remove it aber eben the Paste doesn't throw the Error.

Likes

Translate

Translate
Community Expert ,
Nov 07, 2022 Nov 07, 2022

Copy link to clipboard

Copied

Perhaps there's something running on the machine that messes with the clipboard completely unrelated to AI... I'd check that.

 

Mylenium

Likes

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 ,
Nov 07, 2022 Nov 07, 2022

Copy link to clipboard

Copied

I already did, and also refreshed drivers on the machine. I doubt that it is a problem with the clipboard hence it working with the alert() before pasting.

Likes

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 ,
Nov 07, 2022 Nov 07, 2022

Copy link to clipboard

Copied

Hi,

Could you please share your code, that will help us to debug and see?

Best regards

Likes

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 ,
Nov 07, 2022 Nov 07, 2022

Copy link to clipboard

Copied

Cant post the whole Code, but here is the function i am using. It is working on two different machines. On the third machine it throws the error BUT only on the second file. The first file is pasted and positioned as it should. 

/**
 *  Copy all Items in file to destination document and position it with positionPasted();
 *  
 *  @Param File file - file to be copied
 *  @Param String pos - position on the file
 *  @Param String size - dimensions of the file
 *  @Param Document destDoc - destination document
 *  @Return 
 */
function placeLaserfiles(file, pos, size, destDoc) {
    var singleFile = app.open(file);

    var orientation = null;
    if (singleFile.width > singleFile.height) {
        orientation = "landscape";
    } else {
        orientation = "portrait";
    }

    for(var i = 0; i < singleFile.pageItems.length; i++) {
        singleFile.pageItems[i].selected = true;
    }

    app.copy();
    destDoc.activate();
    //alert("test");
    app.paste();

    positionPasted(pos, size, orientation, destDoc);
    singleFile.close(SaveOptions.DONOTSAVECHANGES);
    return;
}

 

Likes

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 ,
Nov 07, 2022 Nov 07, 2022

Copy link to clipboard

Copied

It works well. It may be not getting enough time to get document activated on the machine where you see an error. 

Could you please try by writing?

destDoc.activate();
destDoc.activate();
destDoc = app.activeDocument;
app.paste(); 
Best regards

Likes

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 ,
Nov 07, 2022 Nov 07, 2022

Copy link to clipboard

Copied

Unfortunately it didnt work. I also already tried a time Delay for a few seconds and app.redraw() commands, but that didn't work either.

Likes

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 ,
Nov 07, 2022 Nov 07, 2022

Copy link to clipboard

Copied

does the error happen when destDoc is a new blank document?

Likes

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 ,
Nov 08, 2022 Nov 08, 2022

Copy link to clipboard

Copied

Destdoc ist a new blank document, but the Error occurs only in the second time Paste is executed - so there ist already content in the document. 

 

But i already got a workaround - before pasting i add a temp pathitem and remove it aber eben the Paste doesn't throw the Error.

Likes

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 ,
Nov 08, 2022 Nov 08, 2022

Copy link to clipboard

Copied

glad to hear you find a workaround, copy/paste is troublesome, I avoid it at most times. I use duplicate() instead, it is more reliable.

Likes

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 ,
Nov 16, 2022 Nov 16, 2022

Copy link to clipboard

Copied

LATEST

Unfortunately i am bound to app.copy because i work with layers an duplicate doesnt work for doc.selection or a layer object. The only way is to write a function that groups everything in a layer, creates a corrisponding layer in the new doc and duplicates the group into the coresponding layer. But in this case you have to work with app.executeCommand("group") or with a nested for-loop to move every pageItem to the new group. In each case it seems like a lot of extra steps for a simple copy/paste.  Everything would be better if placedItem simply would import the layers 😞

Likes

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