Copy link to clipboard
Copied
Hey there,
I'm trying to catch a "undo" event with my HTML panel, but I can't get it to work. I'm already successfully dealing with numerous events, but for some reasons, the "undo" one isn't working.
charIDToTypeID('undo')
charIDToTypeID('Undo')
stringIDToTypeID('undo')
stringIDToTypeID('Undo')
... all of those return a different TypeID. Tried them all. None of them works.
Any clue ?
Thanks.
J
Try to intercept "invokeCommand" with "commandID" == 101
var idinvokeCommand = stringIDToTypeID( "invokeCommand" );
var desc15 = new ActionDescriptor();
var idcommandID = stringIDToTypeID( "commandID" );
desc15.putInteger( idcommandID, 101 );
var idkcanDispatchWhileModal = stringIDToTypeID( "kcanDispatchWhileModal" );
desc15.putBoolean( idkcanDispatchWhileModal, true );
executeAction( idinvokeCommand, desc15, DialogModes.NO );
Copy link to clipboard
Copied
executeAction(stringIDToTypeID('undoEvent'))
Copy link to clipboard
Copied
Hi,
This returns the same typeID as
charIDToTypeID('undo')
but it's not triggered by the EventListener...
Copy link to clipboard
Copied
Hi,
Did you try using
var cs = new CSInterface();
cs.addEventListener("PhotoshopCallback", function(event) {
console.log(event);
if (event.data.split(',')[0] === "1970168943") {
// Do whatever you want to after undo event.
}
});
Copy link to clipboard
Copied
I have tried, whenever I try to do undo, it returns "1684816969", and this id is also return everytime even if you create a rectangle. So, above id mentioned is not working at my end too.
Copy link to clipboard
Copied
So...you're saying this doesn't work either... right ?
I'm having a hard time believing there's no way to catch an UNDO. This makes no sense. I've got a panel that does something when, for instance, you add a new layer. Now, everything is fine, but if the user uses the UNDO function, my panel needs to know about it, or everything else goes wild. 😕
Copy link to clipboard
Copied
Yes, this doesn't work. I am not sure is there any way to catch UNDO event, because I havn't used UNDO event in any of my project till now. Let's try to catch some experts here who may helps us or guide us.
Copy link to clipboard
Copied
bump.
Anyone ?
Copy link to clipboard
Copied
Still wondering about this one... Can't believe there is no way to catch an Undo event and have our extensions behave accordingly...
Anyone ?
Copy link to clipboard
Copied
Try to intercept "invokeCommand" with "commandID" == 101
var idinvokeCommand = stringIDToTypeID( "invokeCommand" );
var desc15 = new ActionDescriptor();
var idcommandID = stringIDToTypeID( "commandID" );
desc15.putInteger( idcommandID, 101 );
var idkcanDispatchWhileModal = stringIDToTypeID( "kcanDispatchWhileModal" );
desc15.putBoolean( idkcanDispatchWhileModal, true );
executeAction( idinvokeCommand, desc15, DialogModes.NO );
Copy link to clipboard
Copied
Great ! Thanks for this !
Actually, simply adding "invokeCommand" to the list of events I am listening for did the trick.
I am curious tho... is there a list of available commandIDs anywhere ?
Thx again !
Copy link to clipboard
Copied
This is the menu command code. Most of them can be obtained using the code:
#target photoshop;
var s2t =stringIDToTypeID;
(r = new ActionReference()).putProperty (s2t('property'), p = s2t('menuBarInfo'))
r.putEnumerated(s2t("application"), s2t("ordinal"), s2t("targetEnum"));
(d = new ActionDescriptor()).putObject(s2t("object"), s2t("object"), executeActionGet(r));
var menuCommands = executeAction(s2t("convertJSONdescriptor"), d).getString(s2t("json"));
for example:
{
"checked": false,
"command": 101,
"enabled": false,
"kind": "item",
"menuID": 0,
"menuShortcut": {
"commandKey": true,
"controlKey": false,
"keyChar": "Z",
"optionKey": false,
"shiftKey": false
},
"name": "Undo",
"title": "Und&o",
"visible": true
},
The rest can be obtained manually using ScriptListener.8li, or through app.notifiers
r-bin, is there way to call menu commands by their commandID (there are some menu items that cannot be called in the usual way)?
Copy link to clipboard
Copied
Copy link to clipboard
Copied
for example, loop playback option in timeline menu (commandID 4442)
Copy link to clipboard
Copied
alert(typeIDToStringID(2245))
has existed at least since the days of CS6.