Good day ALL!!!
Help me, please.
How do you know what action selected in the panel Аctions?
for Example (see Picture)
http://i064.radikal.ru/1111/e7/854443cf5ba8.jpg
"BS Sepia" is SELECTED
"Flattern" is NOT SELECTED
I tried the standard method
charIDToTypeID( "slct" )
did not work!
How do you know what action selected in the panel Аct
-
pfaffenbichler
How do you know what action selected in the panel Аct
As selecting an Action seems not to create any Scripting Listener Code I suspect it may not be possible to determine the selected Action with JavaScript.
But maybe bumping the thread up the list will attract attention from someone with more insight.
But maybe bumping the thread up the list will attract attention from someone with more insight.
-
stat
How do you know what action selected in the panel Аct
pfaffenbichler wrote:As selecting an Action seems not to create any Scripting Listener Code
Yes, I checked first thing in the Script Listener LOG. There's no such events.
Yes, I checked first thing in the Script Listener LOG. There's no such events.
-
Mike Hale
How do you know what action selected in the panel Аct
Scriptlistener doesn't help but you can find the name of the selected action and it's parent action set using Action Manager.
Code: Select allvar ref = new ActionReference();
ref.putEnumerated( charIDToTypeID("Actn"), charIDToTypeID("Ordn"), charIDToTypeID("Trgt") );
var desc = executeActionGet(ref);
var actionName = desc.getString( charIDToTypeID("Nm ") );
var actionSetName = desc.getString( charIDToTypeID("PrNm") );
alert( 'Current selected action is: '+actionName+'\rin the action set: '+actionSetName );
Code: Select allvar ref = new ActionReference();
ref.putEnumerated( charIDToTypeID("Actn"), charIDToTypeID("Ordn"), charIDToTypeID("Trgt") );
var desc = executeActionGet(ref);
var actionName = desc.getString( charIDToTypeID("Nm ") );
var actionSetName = desc.getString( charIDToTypeID("PrNm") );
alert( 'Current selected action is: '+actionName+'\rin the action set: '+actionSetName );
-
kpt
How do you know what action selected in the panel Аct
That's quite a good trick Mike!
Be aware though that the result is different if the action palette is not in Button mode and the selected action has been "unfolded", i.e., opened up to reveal it's contents. In that situation, the actionSetName contains the action name, at least on CS5 on a Mac.
Be aware though that the result is different if the action palette is not in Button mode and the selected action has been "unfolded", i.e., opened up to reveal it's contents. In that situation, the actionSetName contains the action name, at least on CS5 on a Mac.
-
Mike Hale
How do you know what action selected in the panel Аct
That is strange. For me I get the same action and actionSet alert if the action is expanded or collapsed. I tested in CS5 so it may be a Mac thing.
However there are a couple of problems with the function. If only the actionSet is selected it throws an error. I guess that makes sense because no action is selected. A try/catch would fix that. But if a step in the action is selected it returns the set as the action name and the action as the actionSetName. I don't see an easy fix for that. The descriptor has the same keys for both the action and the step so there is no direct way to tell which it is from the descriptor. I guess you would have to get a list of actionSets and make sure actionSetName is a valid actionSet.
In button mode you can not select( highlight ) an action so that mode does not apply to this function.
However there are a couple of problems with the function. If only the actionSet is selected it throws an error. I guess that makes sense because no action is selected. A try/catch would fix that. But if a step in the action is selected it returns the set as the action name and the action as the actionSetName. I don't see an easy fix for that. The descriptor has the same keys for both the action and the step so there is no direct way to tell which it is from the descriptor. I guess you would have to get a list of actionSets and make sure actionSetName is a valid actionSet.
In button mode you can not select( highlight ) an action so that mode does not apply to this function.
-
kpt
How do you know what action selected in the panel Аct
Well, it works in Button mode and that's the most important thing!
I'm including a screendump of the Mac/CS5 situation:
I'm including a screendump of the Mac/CS5 situation:
-
stat
How do you know what action selected in the panel Аct
Mike Hale wrote:Scriptlistener doesn't help but you can find the name of the selected action and it's parent action set using Action Manager.
Code: Select allvar ref = new ActionReference();
ref.putEnumerated( charIDToTypeID("Actn"), charIDToTypeID("Ordn"), charIDToTypeID("Trgt") );
var desc = executeActionGet(ref);
var actionName = desc.getString( charIDToTypeID("Nm ") );
var actionSetName = desc.getString( charIDToTypeID("PrNm") );
alert( 'Current selected action is: '+actionName+'\rin the action set: '+actionSetName );
This code not work if selected "Action step".
I see "Desaturate" of "Action 1"
but I need "Action 1" of "User Set"
obviously want recursion.
We must look for a parent - a parent
I do not know how?
Help me Please.
Code: Select allvar ref = new ActionReference();
ref.putEnumerated( charIDToTypeID("Actn"), charIDToTypeID("Ordn"), charIDToTypeID("Trgt") );
var desc = executeActionGet(ref);
var actionName = desc.getString( charIDToTypeID("Nm ") );
var actionSetName = desc.getString( charIDToTypeID("PrNm") );
alert( 'Current selected action is: '+actionName+'\rin the action set: '+actionSetName );
This code not work if selected "Action step".
I see "Desaturate" of "Action 1"
but I need "Action 1" of "User Set"
obviously want recursion.
We must look for a parent - a parent
I do not know how?
Help me Please.
-
Mike Hale
How do you know what action selected in the panel Аct
This is not be fully tested but seems to work with my limited number of actionSets.
Code: Select allgetSelectedAction()
function getSelectedAction(){
var ref = new ActionReference();
ref.putEnumerated( charIDToTypeID("Actn"), charIDToTypeID("Ordn"), charIDToTypeID("Trgt") );
var desc = executeActionGet(ref);
var selectedName = desc.getString(charIDToTypeID("Nm "));
var selectedIndex = desc.getInteger(charIDToTypeID("ItmI"));
var parentName = desc.getString(charIDToTypeID("PrNm"));
var parentIndex = desc.getInteger(charIDToTypeID("PrIn"));
if(isActionSet( parentIndex, parentName )){
var setName = parentName;
var actionName = selectedName;
}else{
var setName = findAction(parentIndex, parentName );
var actionName = parentName;
}
return [setName,actionName];
};
function isActionSet( parentIndex, parentName ){
var res = false;
try{
var ref = new ActionReference();
ref.putIndex( charIDToTypeID( "ASet" ), parentIndex );
var setName = executeActionGet( ref ).getString(charIDToTypeID("Nm "));
if(setName == parentName) res = true;
}catch(e){}
return res;
};
function findAction(parentIndex, parentName ) {
var i = 1;
var found = false;
while (!found) {
var ref = new ActionReference();
ref.putIndex(charIDToTypeID('ASet'), i);
var desc;
try {
desc = executeActionGet(ref);
} catch (e) {
break;
} finally {
}
if (desc.hasKey(charIDToTypeID('Nm '))) { ;
var setName = desc.getString(charIDToTypeID('Nm '));
var ref = new ActionReference();
ref.putIndex(charIDToTypeID('Actn'), parentIndex);
ref.putIndex(charIDToTypeID('ASet'), i);
try{
var adesc = executeActionGet(ref);
var actName = adesc.getString(charIDToTypeID('Nm '));
if(actName==parentName) return setName;
}catch(e){}
}
i++;
}
};
Code: Select allgetSelectedAction()
function getSelectedAction(){
var ref = new ActionReference();
ref.putEnumerated( charIDToTypeID("Actn"), charIDToTypeID("Ordn"), charIDToTypeID("Trgt") );
var desc = executeActionGet(ref);
var selectedName = desc.getString(charIDToTypeID("Nm "));
var selectedIndex = desc.getInteger(charIDToTypeID("ItmI"));
var parentName = desc.getString(charIDToTypeID("PrNm"));
var parentIndex = desc.getInteger(charIDToTypeID("PrIn"));
if(isActionSet( parentIndex, parentName )){
var setName = parentName;
var actionName = selectedName;
}else{
var setName = findAction(parentIndex, parentName );
var actionName = parentName;
}
return [setName,actionName];
};
function isActionSet( parentIndex, parentName ){
var res = false;
try{
var ref = new ActionReference();
ref.putIndex( charIDToTypeID( "ASet" ), parentIndex );
var setName = executeActionGet( ref ).getString(charIDToTypeID("Nm "));
if(setName == parentName) res = true;
}catch(e){}
return res;
};
function findAction(parentIndex, parentName ) {
var i = 1;
var found = false;
while (!found) {
var ref = new ActionReference();
ref.putIndex(charIDToTypeID('ASet'), i);
var desc;
try {
desc = executeActionGet(ref);
} catch (e) {
break;
} finally {
}
if (desc.hasKey(charIDToTypeID('Nm '))) { ;
var setName = desc.getString(charIDToTypeID('Nm '));
var ref = new ActionReference();
ref.putIndex(charIDToTypeID('Actn'), parentIndex);
ref.putIndex(charIDToTypeID('ASet'), i);
try{
var adesc = executeActionGet(ref);
var actName = adesc.getString(charIDToTypeID('Nm '));
if(actName==parentName) return setName;
}catch(e){}
}
i++;
}
};