Can't open an existing .ai file - illustrator extendscript
hi there, can you please tell me whats wrong with this code:
app.open("~/Desktop/New%20folder/1/v1.ai");
//or
app.open("~//Desktop//New%20folder//1//v1.ai");
//or
app.open("~\Desktop\New%20folder\1\v1.ai");
tried every possible way but nothing worked for me. Actually the code that i'm working on is this:
#target illustrator
var j , len =app.documents.length , docname;
var aiDocumentPath = new Array(); //all the paths of the opened documents will be stored in this array
for( j=0 ; j<len ; j++){
docname = encodeURIComponent(app.documents
aiDocumentPath
}
//all the paths stored
CloseAndOpen();
function CloseAndOpen(){ ///////////////////////////
var aiDocument ;
for(j=0 ; j<len ; j++){
aiDocument = app.activeDocument;
aiDocument.close( SaveOptions.DONOTSAVECHANGES );
aiDocument = null;}
for(j=0 ; j<len ; j++){
alert("oppening "+aiDocumentPath
app.open(aiDocumentPath
}
} /////////////////////////////////