Determine if Info panel is open
I am trying to get my script to determine if the info panel is open, but not necessarily visible. I got this piece of AM code from user Supermerlin a few years ago which works great to detect if a panel is visible. However, if the Info panel open in the workspace and docked in a panel group but not visible (another tab selected in the group), then it returns false. I kind of understand what this AM code is doing but I'm not an AM code expert by any stretch. I am wondering if there is another object value from the descriptor the determines if is is "open" but not visible that could be replaced in the code where 'visible' is. I'm not even sure how to get a list of the available object values for a descriptor.
Basically, I want the script to determine if the user has the info panel anywhere in there workspace before the script runs. Then if after the script runs it will close it if it wasn't in their original workspace. Taking a color sample from the script automatically opens the info panel which is why I'm trying to close it, but only if it wasn't opened to start with.
Anyone able to solve this puzzle?
function isInfoVis(){
var ref = new ActionReference();
ref.putEnumerated( charIDToTypeID("capp"), charIDToTypeID("Ordn"), charIDToTypeID("Trgt") );
var desc = executeActionGet(ref).getList (stringIDToTypeID('panelList'));
for(var a = 1;a<desc.count;a++){
var Name = desc.getObjectValue(a).getString (stringIDToTypeID('name'));
if(Name == 'Info'){
return desc.getObjectValue(a).getBoolean(stringIDToTypeID('visible'));
break;
}
}
}
