Copy link to clipboard
Copied
hI,
I would like to unlink all symbols instances used in a file.
I have tried something that does not work. The script does not unlink because I am stuck at this step.
#target illustrator
var doc=activeDocument;
UnlinkAll(doc);
function UnlinkAll(doc){
var SLen=doc.symbols.length-1;
for (si=SLen;si>-1;si--){
alert(doc.symbolItems.getByName(doc.symbols[si])) ;
return true;
}
}
JPD
Copy link to clipboard
Copied
Is there a method for 'Unlinking' symbol instances?
Copy link to clipboard
Copied
Not that I can see.
Copy link to clipboard
Copied
I even checked in the scripting docs for newer versions that what I have and nothing had changed… In the GUI you could remove the symbol from the palette but you would be prompted for how you wish to handle it… I have not tried this with script and dialogs off…
Copy link to clipboard
Copied
The Scripting Help lists both Symbol and SymbolItem -- but neither of them has 'unlink', or something synonymous ...
Copy link to clipboard
Copied
not an "unlink" method but...
Illustrator.ActiveDocument.Symbols("SymbolName").Delete
will unlink all instances automatically
if you must preserve the symbol duplicate it first, save its name, then rename the duplicate
Copy link to clipboard
Copied
In fact the following script seems to do the job. It unlink the instan
ces while removing the symbols in the symbols palette. I could not make the Delete 'thing' work.
I dont know if it is possible to unlink and keep the symbols.
#target illustrator
var doc=activeDocument;VectorizSymbols All(doc);
function VectorizSymbolAll(doc){
var SLen=doc.symbols.length-1;
for (si=SLen;si>-1;si--){
doc.symbols[si].remove();
}
return true;
}
JPD
Copy link to clipboard
Copied
oh, sorry I should have mentioned the sample code is in VBA, the sintax is a little different. Let me try to do the delete "thing" in JS...
Copy link to clipboard
Copied
here it is
#target illustrator
var doc=activeDocument;
VectorizSymbolAll(doc);
function VectorizSymbolAll(doc){
var SLen=doc.symbols.length-1;
for (si=SLen;si>-1;si--){
var symbolName = doc.symbols[si].name
doc.symbols[si].duplicate(doc, ElementPlacement.PLACEATBEGINNING);
doc.symbols[si].remove();
doc.symbols[symbolName + " 1"].name = symbolName
}
return true;
}