charIDToTypeID Photoshop Javascript

This code was not "written", per se, but was automatically generated by the Script Listener plugin.

Not all of the properties and methods of the Photoshop API are available in the object model, however they are usually still accessible. To use these undocumented features you can install the script listener plugin and perform the actions in Photoshop. The script listener will generate code reflecting the actions you've performed.

For example, there are no explicit methods or properties for the Brush object, but using the script listener, you can open Photoshop, manually adjust the brush size property, and the script listener will automatically generate working, albeit cryptic, code. Any action you perform will be recorded by the script listener so take care not to perform too many actions or you will have a hard time narrowing down the results to those specific methods.

Anyway, I tend to use it as a last resort, but anytime you're dealing with undocumented methods in the Photoshop API, the script listener becomes a necessary evil. Don't assume a method or property isn't available just because it isn't documented. Hope that helps.


This is the site that I usually reference for charIDToTypeID:

http://web.archive.org/web/20140121053819/http://www.pcpix.com/Photoshop/char.htm

(Note linked content is from 2013)

Using this, you can find the string representations from the ScriptListener plug-in. In your case, this is what they mean...

phClassLayer -> 1283027488 -> "Lyr "  layer
phTypeOrdinal -> 1332896878 -> "Ordn"  ordinal
phEnumTarget -> 1416783732 -> "Trgt"  targetEnum