Copy link to clipboard
Copied
Hi, I hope, that someone can help. I want to check if the pathname exists. If YES -do this, else - do that.
I think if the path does not exist the code will crash while trying to use the getByName method. So you can use try catch block to solve your problem
var exists = false
try{
var MyPath = app.activeDocument.pathItems.getByName("name");
exists = true
}
catch(e)
{
}
if (exists) {
Do this ...
}
else {
Do that...
}
-Manan
Copy link to clipboard
Copied
I think if the path does not exist the code will crash while trying to use the getByName method. So you can use try catch block to solve your problem
var exists = false
try{
var MyPath = app.activeDocument.pathItems.getByName("name");
exists = true
}
catch(e)
{
}
if (exists) {
Do this ...
}
else {
Do that...
}
-Manan
Copy link to clipboard
Copied
It works 🙂
Thank you!