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 17, 2019

sorry, I did it the same way but it never works,i used  CC2017/CC2019 in win10, i think the MAC you used?Is MAC system different from Windows?


I’m not sure, I would expect the features to work the same between Windows OS and Mac OS. Yes I’m on a Mac but using CC2018...