2016-09-08 1 views
0

Il y a quelques compoundPathItems dans myfile.aichemin composé dans Adobe Illustrator par le script

Comment puis-je exécuter « Objet> Chemin composé> Marque » ou « envoyer ctrl + 8 » de jsx? À la ligne avec le commentaire ERREUR ICI je reçois un message d'erreur "Un nouvel objet ne peut pas être créé à l'emplacement spécifié".

#target illustrator 

if (app.documents.length > 0) { 
    var idoc = app.activeDocument; 
    var cp = idoc.compoundPathItems.add(); 
    var allPaths = activeDocument.pathItems; 
    //Select objects 
    for(var i = 0;i < allPaths.length;i++){ 
     allPaths[i].selected = true; 
    } 

    var selection = app.activeDocument.selection; 
    for (var i=0; i<selection.length; i++) { 
     selection[i].move (cp, ElementPlacement.PLACEATEND); // move selected path inside the compound path ERROR HERE 
     selection[i].evenodd = true; // necessary to determine "insideness" or to make holes. 
    } 

    alert(selection); 

Répondre

0
app.executeMenuCommand("compoundPath");