Skip to main content
Known Participant
September 30, 2020
Answered

Photoshop action Manager Code

  • September 30, 2020
  • 1 reply
  • 602 views

Hi Everyone,

In Photoshop Scripting, I have using some action script to automate the functionality to update the Character style and Paragraph style.

First of all whats is charIDToTypeID(s) & tringIDToTypeID(s) and how to use it in the code?

 

 

This topic has been closed for replies.
Correct answer jazz-y

These are hash functions. ActionManager keys are stored as a hash table (numeric key: value). Accordingly, to work with ActionManager, we need functions so that human-readable variable names are converted to these keys (and vice versa). charIDToTypeID is an older implementation (variables with a length of 4 characters are used to get the hash table key), stringIDToTypeID is a newer one (a string variable is used to get the key). There are also inverse functions - typeIDToStringID and typeIDToCharID (the name of a human-readable variable name is returned from the numeric key value).
There are variables for which the key can be obtained only through charIDToTypeID, there are variables for which the key can be obtained only through stringIDToTypeID. However, for most variables, charIDToTypeID (s) == stringIDToTypeID (s). In most cases, you can use stringIDToTypeID (it's easier to read variable names in code). charIDToTypeID is rarely needed.

1 reply

jazz-yCorrect answer
Legend
September 30, 2020

These are hash functions. ActionManager keys are stored as a hash table (numeric key: value). Accordingly, to work with ActionManager, we need functions so that human-readable variable names are converted to these keys (and vice versa). charIDToTypeID is an older implementation (variables with a length of 4 characters are used to get the hash table key), stringIDToTypeID is a newer one (a string variable is used to get the key). There are also inverse functions - typeIDToStringID and typeIDToCharID (the name of a human-readable variable name is returned from the numeric key value).
There are variables for which the key can be obtained only through charIDToTypeID, there are variables for which the key can be obtained only through stringIDToTypeID. However, for most variables, charIDToTypeID (s) == stringIDToTypeID (s). In most cases, you can use stringIDToTypeID (it's easier to read variable names in code). charIDToTypeID is rarely needed.

Legend
September 30, 2020

Not quite correctly expressed: most of the keys can be obtained using both charIDToTypeID and stringIDToTypeID, for example stringIDToTypeID ('application') == charIDToTypeID ('capp')