Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

charIDToTypeID Photoshop Javascript

Okay, I understand that charIDToTypeID converts a string into the ID photoshop can actually use but I'm seeing ones I cannot find reference for:

 var idLyr = charIDToTypeID( "Lyr " );
 var idOrdn = charIDToTypeID( "Ordn" );
 var idTrgt = charIDToTypeID( "Trgt" );

What is "Lyr ", "Ordn" and "Trgt" - I googled to find reference but they don't show up in the adobe reference info: http://cssdk.host.adobe.com/sdk/1.0/docs/WebHelp/app_notes/photoshop.htm

I'm trying to find out how this person wrote there code and I'm wondering how they choose to use those IDs when there is no reference to them online.

like image 268
Stan Lindsey Avatar asked Dec 15 '12 16:12

Stan Lindsey


People also ask

How do I run Javascript in Photoshop?

Open Photoshop. Select File > Scripts > Browse and navigate to the 'Scriptname. jxs' file. The script will run.

Can you script in Photoshop?

Creating a script in Photoshop is a relatively simple process. First, open Photoshop and create a new document. Then, open the “File” menu and click “New.” In the “New” dialog box, select “Script.” Next, choose a name for your script and click “OK.” A new document will appear with the script interface.


1 Answers

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.

like image 141
pdizz Avatar answered Sep 17 '22 15:09

pdizz