Typeidtocharid; Typeidtostringid - Adobe 19400084 - Photoshop CS3 Extended Manual

Javascript scripting reference
Table of Contents

Advertisement

JavaScript Scripting Reference
Method

typeIDToCharID

(typeID)

typeIDToStringID

(typeID)
First Sample Script
The following script invokes an alert box to display Properties important to an application such as version
number, the path to the application, the amount of memory available, and the number of documents
open.
When a user presses the OK button on the alert box, a second dialog opens, which asks users whether they
would like the foreground and background colors set for the document presently open. If no document is
open, the script opens a new document for the user.
The script (with no document open) produces a progression of three dialogs.
Application.jsx
//Create a Welcome message
// Use the name and version properties of the application object to
// Append the application's name and version to the Welcome message
// use "\r" to insert a carriage return
// use the combination operator += to append info to the message
var message = "Welcome to " + app.name
message += " version " + app.version + "\r\r"
// find out where Adobe Photoshop CS3 is installed
// and add the path to the message
// add the optional parameter fsName to the path property
// to display the file system name in the most common format
message += "I'm installed in " + app.path.fsName + "\r\r"
// see how much memory Adobe Photoshop CS3 has to play with
message += "You have this much memory available for Adobe Photoshop CS3: " +
app.freeMemory + "\r\r"
// use the length property of the documents object to
// see how many documents are open
var documentsOpen = app.documents.length
message += "You currently have " + documentsOpen + " document(s) open.\r\r"
// display the message to the user
alert(message)
// answer will be true for a "Yes" answer and false for a "No" answer
var answer = confirm("Do you want me to set the foreground and background to my
favorite colors?")
// set the colors
if (answer) {
// I don't have a favorite color. Why did I ask you may wonder?
app.foregroundColor.rgb.red = Math.random() * 255
app.foregroundColor.rgb.green = Math.random() * 255
app.foregroundColor.rgb.blue = Math.random() * 255
Adobe Photoshop CS3
Parameter Type
number (long)
number (long)
Returns
What it does (Continued)
Converts from a runtime ID to
string
a character ID.
Converts from a runtime ID to
string
a string ID.
JavaScript Object Reference
50

Hide quick links:

Advertisement

Table of Contents
loading

This manual is also suitable for:

Photoshop cs3

Table of Contents