Skip to main content
Participating Frequently
January 26, 2020
Answered

breakLink() Illustrator 2020 Issues

  • January 26, 2020
  • 1 reply
  • 514 views

Until recently after updating illustrator to 2020 this code worked fine to break link to symbols. Now I get

ERROR: 1302, No such element Anyone have any suggestions?

 

 

"var rs = 'Script completed without error.';
var docRef = null;
var symbolRef = null;
var iCount = 0;

try { 
    docRef = app.activeDocument;
    iCount = docRef.symbolItems.length;
    for (var num = 0; num<iCount; num++)
    {  symbolRef = docRef.symbolItems[num];
    symbolRef.breakLink();
    }
}    
catch(err)
{
    rs = 'ERROR: ' + (err.number & 0xFFFF) + ', ' + err.description;
    alert(rs);
}"

 

This topic has been closed for replies.
Correct answer CarlosCanto

your script wouldn't work in any version. Looping forward resets the number of items to evaluate, making everyother item unavailable. Looping backwards solves the issue.

 

var docRef = null;
var symbolRef = null;
var iCount = 0;

try {
docRef = app.activeDocument;
iCount = docRef.symbolItems.length;
for (var num = iCount-1; num>=0; num--)
{ symbolRef = docRef.symbolItems[num];
symbolRef.breakLink();
}
}
catch(err)
{
rs = 'ERROR: ' + (err.number & 0xFFFF) + ', ' + err.description;
alert(rs);
}

 

1 reply

CarlosCanto
Community Expert
CarlosCantoCommunity ExpertCorrect answer
Community Expert
January 26, 2020

your script wouldn't work in any version. Looping forward resets the number of items to evaluate, making everyother item unavailable. Looping backwards solves the issue.

 

var docRef = null;
var symbolRef = null;
var iCount = 0;

try {
docRef = app.activeDocument;
iCount = docRef.symbolItems.length;
for (var num = iCount-1; num>=0; num--)
{ symbolRef = docRef.symbolItems[num];
symbolRef.breakLink();
}
}
catch(err)
{
rs = 'ERROR: ' + (err.number & 0xFFFF) + ', ' + err.description;
alert(rs);
}

 

Participating Frequently
January 26, 2020

I guess I got lucky with the amount of items. Thank you for your quick response!