Need help with events listening in HTML panel script

Anyone, especially newbies, asking for help with Photoshop Scripting and Photoshop Automation - as opposed to those contributing to discussion about an aspect of Photoshop Scripting

Moderators: xbytor, Kukurykus, Tom

jkemp
Posts: 1
Joined: Tue May 12, 2020 3:37 pm

Need help with events listening in HTML panel script

Post by jkemp »

Hey there,

I'm currently working on a HTML panel for Photoshop. I'm having trouble with the EventListener. Well, with one particular event, the "applyLocking" one. This should fire when you change the locking status of a layer.

I already have an event listenner setup (using csInterface and "com.adobe.PhotoshopJSONCallback", and it works just fine with most events I listen to, but for some reasons, the "applyLocking" works only alf the time...

At first, I tried using static events TypeID. I had seen a few example around with this method... So, I declared my events like this :

Code: Select all

var eventMake = 1298866208; // "Mk  " *****
var eventDelete = 1147958304; // "Delete" *****
var eventPlay = 1349286176; // "Ply " 
var eventSelect = 1936483188; // "slct" 
var eventSet = 1936028772; // "setd"
var eventMerge = 1299343154; // "Mrg2" *****
var eventRename = 1382968608; // "Rnm " 
var eventMove = 1836021349; // "move" *****
var eventShow = 1399355168; // "Shw " 
var eventHide = 1214521376; // "Hd  " 
var eventDuplicate = 1148218467; // "duplicate" ***** 
var eventPaste = 1885434740; // "paste" *****
var eventLock = 406; // lock

... and then passed those to my CSEvent().data. Gave it a try and it worked flawlessly.

But then... I read that TypeIDs were not "always" the same... so I rebooted PS and gave it another try. The "lock" event didn't fire.

I then made adjustments to pass stringIDs and charIDs instead of the hardcoded TypeIDs. I noticed that that the "applyLocking" stringID was now converted to "410".

So far so good... but I then realised that even if I used the stringIDs, I got problem with the lock event. Sometimes it works, sometimes it doesn't. And I just can't figure out what is going on.

Of course, I noticed that the "applyLocking" TypeID (406 or 410) is kinda strange when compared to other event TypeIDs. All the other ones I tried are 10-digits numbers...

The ScriptListeninng plugins really spits out a "applyLocking" event when I use the locking functions... but maybe that's not what I should be listenning for ?

You guys have any clues ?

Working on PS2020, in MacOS High Sierra.


Thanks a lot !

JK.