Copy link to clipboard
Copied
Adobe Illustrator 2019 worked fine on Friday (10/23/2020), but today the icon has been replaced with a question mark and the application itself is gone.
Does anyone know what's going on with that, or how to get it back?
There's a specific script that I use frequently that only works on 2019, so it's extremely inconvenint to not even be able to use it.
Hi,
Try using following code
#target illustrator
function RenameArtFromText() {
if (app.documents.length > 0 && app.documents[0].selection.length) {
function getTextFile() {
var fileType = ($.os.match("Windows")) ? "*.txt;" : function (f) {
return f instanceof Folder || (f instanceof File && f.name.match(/(.txt|.js)$/));
};
var textFile = File.openDialog("Choose a text file.", fileType);
if (textFile != null) {
...
Copy link to clipboard
Copied
Do you have auto-update enabled in the CC app? Is it set to 'Remove old versions'?
Copy link to clipboard
Copied
Hi,
Adobe policy changed, so currently only the latest and one version back may be downloaded from the CC app.
Did you try your script in updated version? If yes, did you face any errors or issues with that?
Copy link to clipboard
Copied
2019 allows scripts to read .txt files, and 2020+ doesn't. It's the only reason I keep using 2019, haven't been able to find the time to get a good work around for the script yet.
Copy link to clipboard
Copied
I don't think there is an issue while reading the text file. I have written small script which read file text.txt that exists inside the Desktop folder and show its data on alert. This is working in 2021.
var file = File('~/Desktop/test.txt');
if (file.exists) {
file.open('r');
var data = file.read();
alert(data);
}
Copy link to clipboard
Copied
Copy link to clipboard
Copied
Hi,
Try using following code
#target illustrator
function RenameArtFromText() {
if (app.documents.length > 0 && app.documents[0].selection.length) {
function getTextFile() {
var fileType = ($.os.match("Windows")) ? "*.txt;" : function (f) {
return f instanceof Folder || (f instanceof File && f.name.match(/(.txt|.js)$/));
};
var textFile = File.openDialog("Choose a text file.", fileType);
if (textFile != null) {
return textFile;
} else {
alert("Canceled");
return null;
}
};
var textFile = getTextFile();
if (textFile != null) {
textFile.open('r');
var namesArray = textFile.read().split("\n");
textFile.close();
var doc = app.activeDocument;
for (var i = 0; i < namesArray.length; i++) {
try {
var thisName = namesArray[i];
var thisItem = doc.selection[i];
thisItem.name = thisName;
} catch (e) {
// do nothing
}
}
alert("Done with " + i + " names");
}
} else {
alert("No AI document is open or no selection.");
}
}
RenameArtFromText();
f.displayName does not work. Instead of that please use f.name
Copy link to clipboard
Copied
Wow that's incredible, is the only differance that 2020 no longer recognizes f.displayName?
Copy link to clipboard
Copied
There may be more differences but currently, I don't have list of changes. While debugging your script I found that displayName return empty, and that's why it does not allow to select the file.