Using the GUI of the Properties panel to close...
Or as an alternative:
- Have the properties panel open
- Clear the ScriptListener log
- 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