• Global community
    • Language:
      • Deutsch
      • English
      • Español
      • Français
      • Português
  • 日本語コミュニティ
    Dedicated community for Japanese speakers
  • 한국 커뮤니티
    Dedicated community for Korean speakers
Exit
0

Photoshop HTML Panel Events : Catch an "Undo" event.

Participant ,
May 22, 2020 May 22, 2020

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

TOPICS
Actions and scripting , SDK

Views

2.0K

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines

correct answers 1 Correct answer

People's Champ , Jun 29, 2020 Jun 29, 2020

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 );

 

Votes

Translate

Translate
Adobe
LEGEND ,
May 22, 2020 May 22, 2020

Copy link to clipboard

Copied

executeAction(stringIDToTypeID('undoEvent'))

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Participant ,
May 22, 2020 May 22, 2020

Copy link to clipboard

Copied

Hi,

 

This returns the same typeID as

 

charIDToTypeID('undo')

 

but it's not triggered by the EventListener... 

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Community Expert ,
May 22, 2020 May 22, 2020

Copy link to clipboard

Copied

Hi,

Did you try using 

PSEvent.UNDO = "1970168943";
 
Usage will be like

 

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.
}
});

 

*Not tried this one at my end, but yes I use other event like this. So you can give it a try.
Best regards

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Community Expert ,
May 22, 2020 May 22, 2020

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.

 

Best regards

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Participant ,
May 24, 2020 May 24, 2020

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.  😕

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Community Expert ,
May 24, 2020 May 24, 2020

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.

 

Best regards

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Participant ,
May 28, 2020 May 28, 2020

Copy link to clipboard

Copied

bump.   

 

Anyone ?

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Participant ,
Jun 28, 2020 Jun 28, 2020

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 ?

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
People's Champ ,
Jun 29, 2020 Jun 29, 2020

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 );

 

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Participant ,
Jun 29, 2020 Jun 29, 2020

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 !

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Guide ,
Jun 29, 2020 Jun 29, 2020

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)?

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
People's Champ ,
Jun 30, 2020 Jun 30, 2020

Copy link to clipboard

Copied

 
By commandID is impossible, as far as I know.
Most likely, Adobe simply did not complete the code.

Which menu cannot you call in the standard way?
 

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Guide ,
Jun 30, 2020 Jun 30, 2020

Copy link to clipboard

Copied

for example, loop playback option in timeline menu (commandID 4442)

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
People's Champ ,
Jul 01, 2020 Jul 01, 2020

Copy link to clipboard

Copied

LATEST
Most likely another error that will never be fixed.
The identifier
alert(typeIDToStringID(2245))
has existed at least since the days of CS6.
But never described and absent in PITerminology.h
 

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines