Adobe Smoke Alarm CS3 Manuale Utente
Photoshop CS3
Adobe Photoshop CS3 Scripting Guide
Scripting Photoshop CS3 47
In a script, you can access a
Document
object’s history states using the
HistoryStates
object, which is a
property of the
Document
object. You can use a
HistoryStates
object to reset a document to a previous
state or to fill a
Selection
object.
The following examples revert the document contained in the variable
docRef
back to the form and
properties it had when it was first opened or created. Using history states in this fashion gives you the
ability to undo modifications to the document.
ability to undo modifications to the document.
AS
set current history state of current document to history state 1 ¬
of current document
VBS
docRef.ActiveHistoryState = docRef.HistoryStates(1)
JS
docRef.activeHistoryState = docRef.historyStates[0]
Note:
Reverting back to a previous history state does not remove any later states from the history
collection. Use the
collection. Use the
Purge
command to remove later states from the
History States
collection as
shown below:
●
AS:
purge history caches
●
VBS:
appRef.Purge(2) 'for psPurgeTarget --> 2 (psHistoryCaches)
●
JS:
app.purge(PurgeTarget.HISTORYCACHES)
The example below saves the current state, applies a filter, and then reverts back to the saved history state.
AS
set savedState to current history state of current document
filter current layer of current document using motion blur with options ¬
filter current layer of current document using motion blur with options ¬
{class:motion blur, angle:20, radius:20}
set current history state of current document to savedState
VBS
Set savedState = docRef.ActiveHistoryState
docRef.ArtLayers(1).ApplyMotionBlur 20, 20
docRef.ActiveHistoryState = savedState
docRef.ArtLayers(1).ApplyMotionBlur 20, 20
docRef.ActiveHistoryState = savedState
JS
savedState = docRef.activeHistoryState
docRef.artLayers[0].applyMotionBlur( 20, 20 )
docRef.activeHistoryState = savedState
docRef.artLayers[0].applyMotionBlur( 20, 20 )
docRef.activeHistoryState = savedState
Using Notifier Objects
You use the
Notifier
object to tie an event to a script. For example, if you would like Photoshop CS3 to
automatically create a new document when you open the application, you could tie a script that creates a
Document
object to an
Open Application
event.