isPanelVisible [CS5]

Photoshop Script Snippets - Note: Full Scripts go in the Photoshop Scripts Forum

Moderators: xbytor, DavideBarranca, Paul MR

Mike Hale

isPanelVisible [CS5]

Postby Mike Hale » Fri Feb 24, 2012 3:16 pm

While looking for something else I noticed that CS5 has a new key in the capp descriptor named panelList. It's not as helpful as I had hoped but at least you can check to see if a panel is visible instead of toggling the panel it hope that it shows/hides.
Code: Select all
/* some common panel names
Tools
Hand Options
Actions
Styles
Swatches
Histogram
Info:
Paths
Tool Presets
Color
Channels
Layers
Layer Comps
Animation
Clone Source
Adjustments
Masks
Measurement Log:
History
Navigator
Character
Paragraph
Notes
3D
Brush
Brush Presets
Mini Bridge
*/
isPanelVisible( 'Layers' );
function isPanelVisible( PnlName ){
   var ref = new ActionReference();
   ref.putEnumerated( charIDToTypeID("capp"), charIDToTypeID("Ordn"), charIDToTypeID("Trgt") );
   var panelList = executeActionGet(ref).getList(stringIDToTypeID('panelList'));   
   var count = panelList.count;
   for(var i=0;i<count-5;i++){ //enumerate list
      var desc = panelList.getObjectValue(i);
      var pName = desc.getString(charIDToTypeID("Nm  "));
      if(pName == PnlName) return desc.getBoolean(charIDToTypeID("Vsbl"));
   }
}



Return to “Photoshop Scripting: Code Snippets”

Who is online

Users browsing this forum: No registered users and 1 guest