Copy link to clipboard
Copied
Hi Every one,
In my below code, if the font folder "Packaging_Fonts"is missing I cant able to alert missing font folder. Could anyone help me out
Copy link to clipboard
Copied
Hi,
Try this
function fontUpdate() {
var myFolderName = []
var myFolder = new Folder('~/Documents/Adobe Scripts/scriptResources_Packaging/cfo/');
var myFolderList = myFolder.getFiles()
for (i = 0; i < myFolderList.length; i++) {
if (myFolderList[i].name.indexOf("Packaging_Fonts") !== -1) {
myFolderName.push(myFolderList[i].name)
}
}
if (myFolderName.length == 0) {
alert("missing")
}
}
fontUpdate()
Or even you can use Folder API to test whether folder exists or not. A sample for this is as follows
function checkFolderExists() {
var _folder = new Folder('~/Documents/Adobe Scripts');
if (_folder.exists) {
alert("Folder exists")
} else {
alert("Folder missing")
}
}
Copy link to clipboard
Copied
Change the condition to the following and then try
if (UpdatedFolder==undefined)
-Manan