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!
1 Correct answer
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.
Explore related tutorials & articles
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
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.
Copy link to clipboard
Copied
Hi,
Could you please share your code, that will help us to debug and see?
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;
}
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();
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.
Copy link to clipboard
Copied
does the error happen when destDoc is a new blank document?
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.
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.
Copy link to clipboard
Copied
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 😞

