Copy link to clipboard
Copied
I"m trying to add a script notifier to handle the event when the user places a smart object which they link to their cloud library.
This (I believe) is the relevant code which is generated when I performed this action
//
=======================================================
var idpast = charIDToTypeID( "past" );
var desc11 = new ActionDescriptor();
var idAntA = charIDToTypeID( "AntA" );
desc11.putBoolean( idAntA, true );
var idAs = charIDToTypeID( "As " );
var idsmartObject = stringIDToTypeID( "smartObject" );
desc11.putClass( idAs, idsmartObject );
var idpushToDesignLibraries = stringIDToTypeID("pushToDesignLibraries" );
desc11.putBoolean( idpushToDesignLibraries, true );
var idFTcs = charIDToTypeID( "FTcs" );
var idQCSt = charIDToTypeID( "QCSt" );
var idQcsa = charIDToTypeID( "Qcsa" );
desc11.putEnumerated( idFTcs, idQCSt, idQcsa );
var idOfst = charIDToTypeID( "Ofst" );
var desc12 = new ActionDescriptor();
var idHrzn = charIDToTypeID( "Hrzn" );
var idRlt = charIDToTypeID( "#Rlt" );
desc12.putUnitDouble( idHrzn, idRlt, 0.000000 );
var idVrtc = charIDToTypeID( "Vrtc" );
var idRlt = charIDToTypeID( "#Rlt" );
desc12.putUnitDouble( idVrtc, idRlt, 0.000000 );
var idOfst = charIDToTypeID( "Ofst" );
desc11.putObject( idOfst, idOfst, desc12 );
executeAction(idpast, desc11, DialogModes.NO );
According to what I have read in the documentation, I need the event iD from the 'executeAction' line, which should be the variable "idpast" ("past"), and the class ID from the 'putObject' line, which is the variable "idOfst" ( "Ofst" )
I tried the following code, but the event does not trigger the script (eventFile is the file which contains the javascript code to run for this event):
app.notifiers.add("past", eventFile, "Ofst")
Can anyone help me to determine the correct EventID and ClassID for this event notifier?
Copy link to clipboard
Copied
Make sure you add this line:
app.notifiersEnabled = true;
And try this as well:
app.notifiers.add(charIDToTypeID("past"), eventFile, charIDToTypeID("Ofst"))
Copy link to clipboard
Copied
Thanks for the response.
I do have the line 'app.notifiersEnabled = true' in my code, I am creating several notifiers, and the other events work properly, using the same script file, so I know that the script runs properly, and my syntax is correct for those events.
I tried adding your suggested text, but it's still not running the script when the event occurs.
Copy link to clipboard
Copied
I am able to repro your problem as well. And sometimes i see a "past" event and sometimes I'm getting a "Plc " event. Houston, we have a problem....stay tuned...I'm using latest CC app. 2015.5. Adobe Photoshop Version: 2015.5.1 20160722.r.156 2016/07/22:23:00:00 CL 1083377 x64 What version are you on?
Copy link to clipboard
Copied
I'm on a mac, I have version
2015.5.0 Release
20160603.r.88 x64
Copy link to clipboard
Copied
BTW, the art I'm using is being copy/pasted from Illustrator. So far, I don't recall seeing anything other than the 'Past' event during the paste operation. Were you doing a 'Place' instead of a 'Paste' when you got the 'Plc' event?
The 'Plc' was one of the event notifiers which I am creating that is working; that one was simpler, as it didn't need a Class ID.
Copy link to clipboard
Copied
I first started by using the CC Libraries panel as you said this: I"m trying to add a script notifier to handle the event when the user places a smart object which they link to their cloud library.
Copy link to clipboard
Copied
Sorry, I mistyped my original message, I was doing a 'Paste' and not a 'Place', but I can't see a way to edit the message. - Ok, I found the 'edit button' for this message, but I dont' see it available for the original message.
I also just noticed that the 'Relink to Library Graphic' command does not generate any code at all. If I select a layer, run that command, then delete the layer, all I get are the 'Select' and 'Delete' commands recorded.
Copy link to clipboard
Copied
https://forums.adobe.com/people/Tom+Ruark wrote
Make sure you add this line:
app.notifiersEnabled = true;
And try this as well:
app.notifiers.add(charIDToTypeID("past"), eventFile, charIDToTypeID("Ofst"))
Tom, in which cases should we use the typeID compared to the charID or the stringID?
I've found that I can use either 'select' or 'Slct' with no problems, yet I can only use 'Mk ' and not 'make'. Instead the stringIDToTypeID('make') works as expected – I'm a bit puzzled.
Thank you!
Davide
Copy link to clipboard
Copied
I would prefer four character codes 'hash' over "strings" and we messed up and have many four character "strn" that will catch you up! "make" is a good example of that.
And 'hash' four character codes are easily converted to a number that is always correct. Where the number from stringIDToTypeID("string") should never be stored as it could change the next time you run Photoshop.
Find more inspiration, events, and resources on the new Adobe Community
Explore Now