Answered
Can only determine non existence, but cannot determine non existence?
I need to determine if a paragraph style group exists. Generally, this avoids the judgment of non existence:
//This is the previous practice of using else to determine 'non-existent' in reverse
var d = app.activeDocument;
var item = d.selection[0];
if(d.paragraphStyleGroups.itemByName('AA').isValid){
var myGroup=d.paragraphStyleGroups.itemByName('AA');
alert('AA exist')
}
else{
alert('AA dose not exist')
}But sometimes I need to directly determine that it doesn't exist and find that both of the following are invalid:
//Now I want to directly determine that 'AA' does not exist.
var d = app.activeDocument;
var item = d.selection[0];
if(d.paragraphStyleGroups.itemByName('AA').inValid){
alert('group does not exist');
}
if(!d.paragraphStyleGroups.itemByName('AA').isValid){
alert('group does not exist');
}


