Skip to main content
greless
Inspiring
April 16, 2019
Answered

close Properties panel

  • April 16, 2019
  • 1 reply
  • 2137 views

hi everybody,

     i  want to close the Properties panel,what method it please?

i know this script of runMenuItem can it ,but i need an ActionManager mode.How to transfer it?

app.runMenuItem(stringIDToTypeID("togglePropertiesPanel"))

   

This is wrong...

This topic has been closed for replies.
Correct answer Stephen Marsh

Using the GUI of the Properties panel to close...

Or as an alternative:

  1. Have the properties panel open
  2. Clear the ScriptListener log
  3. Insert a menu item into an action to close the properties panel, you should get the following...

Both methods return the same SL code:

var idslct = charIDToTypeID( "slct" );

    var desc477 = new ActionDescriptor();

    var idnull = charIDToTypeID( "null" );

        var ref75 = new ActionReference();

        var idMn = charIDToTypeID( "Mn  " );

        var idMnIt = charIDToTypeID( "MnIt" );

        var idclosePropertiesPanel = stringIDToTypeID( "closePropertiesPanel" );

        ref75.putEnumerated( idMn, idMnIt, idclosePropertiesPanel );

    desc477.putReference( idnull, ref75 );

executeAction( idslct, desc477, DialogModes.NO );

The same SL code put through the cleanSL script:

select();

function select() {

  var c2t = function (s) {

  return app.charIDToTypeID(s);

  };

  var s2t = function (s) {

  return app.stringIDToTypeID(s);

  };

  var descriptor = new ActionDescriptor();

  var reference = new ActionReference();

  reference.putEnumerated( s2t( "menuItemClass" ), s2t( "menuItemType" ), s2t( "closePropertiesPanel" ));

  descriptor.putReference( c2t( "null" ), reference );

  executeAction( s2t( "select" ), descriptor, DialogModes.NO );

}

While this also works:

app.runMenuItem(stringIDToTypeID("closePropertiesPanel"));

As I’m new to scripting, I’m curious as to why you want multiple lines of code in preference of 1 line of code? They are both equivalent of each other in result and speed (the 10 lines of AM code is very slightly slower than the single line of code above (not that this is noticeable to an end user).

Related links from the sidebar:

Re: How to open or close panels/window with a script?!

Re: Script to open Window/Properties

1 reply

Stephen Marsh
Community Expert
Stephen MarshCommunity ExpertCorrect answer
Community Expert
April 16, 2019

Using the GUI of the Properties panel to close...

Or as an alternative:

  1. Have the properties panel open
  2. Clear the ScriptListener log
  3. Insert a menu item into an action to close the properties panel, you should get the following...

Both methods return the same SL code:

var idslct = charIDToTypeID( "slct" );

    var desc477 = new ActionDescriptor();

    var idnull = charIDToTypeID( "null" );

        var ref75 = new ActionReference();

        var idMn = charIDToTypeID( "Mn  " );

        var idMnIt = charIDToTypeID( "MnIt" );

        var idclosePropertiesPanel = stringIDToTypeID( "closePropertiesPanel" );

        ref75.putEnumerated( idMn, idMnIt, idclosePropertiesPanel );

    desc477.putReference( idnull, ref75 );

executeAction( idslct, desc477, DialogModes.NO );

The same SL code put through the cleanSL script:

select();

function select() {

  var c2t = function (s) {

  return app.charIDToTypeID(s);

  };

  var s2t = function (s) {

  return app.stringIDToTypeID(s);

  };

  var descriptor = new ActionDescriptor();

  var reference = new ActionReference();

  reference.putEnumerated( s2t( "menuItemClass" ), s2t( "menuItemType" ), s2t( "closePropertiesPanel" ));

  descriptor.putReference( c2t( "null" ), reference );

  executeAction( s2t( "select" ), descriptor, DialogModes.NO );

}

While this also works:

app.runMenuItem(stringIDToTypeID("closePropertiesPanel"));

As I’m new to scripting, I’m curious as to why you want multiple lines of code in preference of 1 line of code? They are both equivalent of each other in result and speed (the 10 lines of AM code is very slightly slower than the single line of code above (not that this is noticeable to an end user).

Related links from the sidebar:

Re: How to open or close panels/window with a script?!

Re: Script to open Window/Properties

greless
grelessAuthor
Inspiring
April 16, 2019

Thank you for your reply. Your method is all feasible。
I does not used runMenuItem because Action manager can be used in c++ language.


but the first method may be used ScriptListener.8li,Why can't I? how to "Insert a menu item into an action "?


I sincerely hope to get your reply.

Stephen Marsh
Community Expert
Community Expert
April 16, 2019

Thank you for your reply. Your method is all feasible。
I does not used runMenuItem because Action manager can be used in c++ language.

Thank you for reply.

but the first method may be used ScriptListener.8li,Why can't I? how to "Insert a menu item into an action "?

I had the same SL output result by the following two methods:

1. Clear SL log file

2. Use the Properties panel menu item “close”

or

1. Clear SL log file

2. In an action, use the Action panel menu item to “insert menu command” and then select the Properties panel menu item “close”:

For completeness, here is the xtools output of converting such an action to script:

#target photoshop

cTID = function(s) { return app.charIDToTypeID(s); };

sTID = function(s) { return app.stringIDToTypeID(s); };

function Action15() {

  function step1(enabled, withDialog) {

    if (enabled != undefined && !enabled)

      return;

    var dialogMode = (withDialog ? DialogModes.ALL : DialogModes.NO);

    var desc1 = new ActionDescriptor();

    var ref1 = new ActionReference();

    ref1.putEnumerated(cTID('Mn  '), cTID('MnIt'), sTID("closePropertiesPanel"));

    desc1.putReference(cTID('null'), ref1);

    executeAction(cTID('slct'), desc1, dialogMode);

  };

  step1();

};

Action15.main = function () {

  Action15();

};

Action15.main();