Copy link to clipboard
Copied
Every menu item has a close command and a toogle command.
For example, I can first close the Actions menuItem to toggle it after.
This make sure the panel is visible (even if it is closed or not in first place)
app.runMenuItem (stringIDToTypeID('closeActionsPanel'));
app.runMenuItem (stringIDToTypeID ("toggleActionsPalette"));
But, I have created my own custom Extension (for example, its name is "xxxx")
and I want the same behavior, I can't.
I can only toogle it ( on/off ) and it does not make sure the user remains with my extension visible.
This the only way of refreshing my panel extension (???).
Where is the stringIDToTypeID ("????????") to close my custom extension?
var myExtensionName = "XXXX";
var desc = new ActionDescriptor ();
var ref = new ActionReference ();
ref.putEnumerated (stringIDToTypeID ("menuItemClass"), stringIDToTypeID ("menuItemType"), stringIDToTypeID("extension"));
desc.putReference (stringIDToTypeID ("target"), ref);
var ref1 = new ActionReference();
ref1.putName( charIDToTypeID('Mn '), myExtensionName);
desc.putReference( charIDToTypeID('null'), ref1 );
try {
var ddd = executeActionGet(desc).hasKey( ??????????????????? ); // close my custom panel extension
} catch(e) { $.writeln(e) }
// "select" toogles my custom extention: ON if OFF || OFF if ON
var descXX = executeAction (stringIDToTypeID ("select"), desc, DialogModes.NO);
You can get panel informaion with this..
...$.writeln(listPanels().join("\n"));
function listPanels(){
var ref = new ActionReference();
Info = new Array();
ref.putProperty( charIDToTypeID("Prpr"), stringIDToTypeID("panelList") );
ref.putEnumerated( charIDToTypeID("capp"), charIDToTypeID("Ordn"), charIDToTypeID("Trgt") );
var desc = executeActionGet(ref).getList (stringIDToTypeID("panelList"));
for(var a = 0;a<desc.count;a++){
var Name = desc.getObjectValue(a).getString (stringIDToTypeID("name"));
var Vis =
Copy link to clipboard
Copied
This works for me
var idslct = charIDToTypeID( "slct" );
var desc53 = new ActionDescriptor();
var idnull = charIDToTypeID( "null" );
var ref31 = new ActionReference();
var idMn = charIDToTypeID( "Mn " );
ref31.putName( idMn, "CSS Hat" ); //maybe text from menu?
desc53.putReference( idnull, ref31 );
executeAction( idslct, desc53, DialogModes.NO );
Try record this menu item:
Copy link to clipboard
Copied
That's the problem. It toggles between ON/OFF.
It doesn't care if the extension is already opened or closed.
So, after running it, I can't be sure the extension to be opened for sure.
That is why I wanted to close it first and then use you solution.
To toggle I know it works with the select
charIDToTypeID( "slct" )
on the execute Action.
But I need it to close. And
charIDToTypeID( "Cls " )
doesn't work.
Copy link to clipboard
Copied
What about onload and unload events inside HTML panel: onunload Event
Could it work? I didn't tested it yet.
You could send this data to JSX and then save these custom values into Photoshop. I think, if you close panel, you kill CEP.exe process and if you open it again then page is reloaded.
Copy link to clipboard
Copied
I use this to open and close panels
in a single script.
openPanel("xxx");// panel name
function openPanel(Name) {
var desc1 = new ActionDescriptor();
var ref1 = new ActionReference();
ref1.putName( charIDToTypeID('Mn '), Name);
desc1.putReference( charIDToTypeID('null'), ref1 );
try{
executeAction( charIDToTypeID('slct'), desc1, DialogModes.NO );
}catch(e){}
};
Copy link to clipboard
Copied
But it doesn't allow you to make sure the panel will stay opened in the end.
It will toggle and if closed it opens, and if opened it closes.
I need it to refresh html passing new data from jsx.
To close+open again does that, but I need it to be opened in the begining. And this might not be the case sometimes.
Copy link to clipboard
Copied
You can get panel informaion with this..
$.writeln(listPanels().join("\n"));
function listPanels(){
var ref = new ActionReference();
Info = new Array();
ref.putProperty( charIDToTypeID("Prpr"), stringIDToTypeID("panelList") );
ref.putEnumerated( charIDToTypeID("capp"), charIDToTypeID("Ordn"), charIDToTypeID("Trgt") );
var desc = executeActionGet(ref).getList (stringIDToTypeID("panelList"));
for(var a = 0;a<desc.count;a++){
var Name = desc.getObjectValue(a).getString (stringIDToTypeID("name"));
var Vis = desc.getObjectValue(a).getBoolean(stringIDToTypeID("visible"));
var Ob = desc.getObjectValue(a).getBoolean(stringIDToTypeID("obscured"));
var ID = desc.getObjectValue(a).getString(stringIDToTypeID("ID"));
Info.push([[Name],[Vis],[Ob],[ID]]);
}
return Info;
};
Copy link to clipboard
Copied
Thank you!
Really a super Merlin solution!
Copy link to clipboard
Copied
I have embedded your code to with my function:
updatePanel("myExtensionName");
//
function updatePanel (Name) {
var Vis = false;
var ref = new ActionReference();
ref.putProperty( charIDToTypeID("Prpr"), stringIDToTypeID("panelList") );
ref.putEnumerated( charIDToTypeID("capp"), charIDToTypeID("Ordn"), charIDToTypeID("Trgt") );
var desc = executeActionGet(ref).getList (stringIDToTypeID("panelList"));
for(var a = 0;a<desc.count;a++){
var listName = desc.getObjectValue(a).getString(stringIDToTypeID("name"));
if (Name == listName) {
Vis = desc.getObjectValue(a).getBoolean(stringIDToTypeID("visible"));
var Ob = desc.getObjectValue(a).getBoolean(stringIDToTypeID("obscured"));
var ID = desc.getObjectValue(a).getString(stringIDToTypeID("ID"));
break;
}
}
var desc1 = new ActionDescriptor();
var ref1 = new ActionReference();
ref1.putName( stringIDToTypeID('menuItemClass'), Name);
desc1.putReference( charIDToTypeID('null'), ref1 );
if (Vis) {
try {
executeAction( charIDToTypeID('slct'), desc1, DialogModes.NO );
executeAction( charIDToTypeID('slct'), desc1, DialogModes.NO );
} catch(e) {}
} else {
try {
executeAction( charIDToTypeID('slct'), desc1, DialogModes.NO );
} catch(e) {}
}
}
Copy link to clipboard
Copied
Is it possible to update only the open panel without entering the panel name?
Copy link to clipboard
Copied
Been using Pedro's solution ever since (thanks!).
Yet, I can't get it to work for UXP plugin panels...
Opening these doesn't record into an action either, although it makes you believe it does.
So I got my first UXP panels and wanted both to open at the same time, using an action (playing a script).
I tried Pedro's function (full function in my file, of course):
updatePanel("TK8 Cx");
updatePanel("TK8 Multi-Mask");
First time I played this code from inside ExtendScript Toolkit I thought it had worked (unless I completely fooled myself somehow). So I arranged things to make it operational in an action, but anything I tried never worked again...
So...
(1) Shouldn't Adobe make these things record into an action? (as the UI already suggests they are doing so)
(2) Anyone found a way for UXP panels yet?