Adobe Smoke Alarm CS3 Manuale Utente

Pagina di 85
Photoshop CS3
Adobe Photoshop CS3  Scripting Guide
 Scripting Photoshop CS3     48
Note:
This type of script corresponds to selecting Start Application in the Script Events Manager (File > 
Scripts > Script Events Manager
) in the Photoshop CS3 application. Please refer to Photoshop CS3 
Help for information on using the Script Events Manager. 
The 
make
 (
Add/add
) command requires you to specify an event ID to identify the event to set up 
notification for. Many event IDs are listed in an Appendix in the Adobe Photoshop CS3 JavaScript Scripting 
Reference
Adobe Photoshop CS3 Visual Basic Scripting Reference, and Adobe Photoshop CS3 AppleScript 
Scripting Reference
. Some events also operate on several types of objects, and the 
make
 (
Add/add
command requires an additional argument for a class ID, which identifies the object. For example, the 
“New” command is used for Document, Art Layer, and Channel objects.
Tip:
You can determine the event and class IDs of any recordable event by using ScriptListener. See 
.
The following example shows how to set up event notification for an “Open Document” event. First the 
script ensures that event notification is enabled, then it sets up the event to trigger the execution of the 
Welcome.jsx
 file. Once the script completes, any time you open a document outside of a script, it triggers 
the notification, which runs the 
.jsx
 file. This 
.jsx
 file displays an alert box.
Note:
Notification generally does not take effect on events that occur inside of a script, because these 
events are embedded with in an 
"AdobeScriptAutomation Scripts"
 event.
AS
tell application "Adobe Photoshop CS3"
try
delete notifiers
end try
make new notifier with properties {event:"Opn ", ¬
event file:alias "OS X 10.4.8 US:Users:psauto:Desktop:Welcome.jsx"}
end tell
VBS
Dim appRef,eventFile
Set appRef = CreateObject("Photoshop.Application")
appRef.NotifiersEnabled = True
eventFile = appRef.Path & "Presets\Scripts\Event Scripts Only\Welcome.jsx"
appRef.Notifiers.Add "Opn ", eventFile
JS
app.notifiersEnabled = true
var eventFile = new File(app.path + 
 "/Presets/Scripts/Event Scripts Only/Welcome.jsx")
app.notifiers.add("Opn ", eventFile)
Using the PathItem Object
To create a 
PathItem
 object, you must add a 
PathItem
 to the 
PathItems
 element or collection for a 
document. This requires that you first create an array of 
PathPointInfo
 objects, which specify the 
coordinates of the corners or anchor points of your path. Then you create an array of 
SubPathInfo
 objects 
to contain the 
PathPoint
 arrays.Once you have the points and a subpath, you can add a new 
PathItem
.
The following script creates a 
PathItem
 object that is a straight line.