Adobe 23101335 Scripting Guide - Page 80

History object

Page 80 highlights

Scripting Photoshop 3 History object 3.15 History object Photoshop keeps a history of the actions that affect the appearance of documents. Each entry in the Photoshop History palette is considered a "History State." These states are accessable from document object and can be used to reset the document to a previous state. A history state can also be used to fill a selection. To set your document back to a particular state, set the document's current history state: AS: set current history state of current document to history state 1 ¬ of current document VB: docRef.ActiveHistoryState = docRef.HistoryStates(1) JS: docRef.activeHistoryState = docRef.historyStates[0]; The code above sets the current history state to the top history state that is in the History palette. Using history states in this fashion give you the ability to undo the actions that were taken to modify the document. 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 document using motion blur with options ¬ {angle:20, radius: 20} set current history state of current document to savedState VB: Set savedState = docRef.ActiveHistoryState docRef.ApplyMotionBlur 20, 20 docRef.ActiveHistoryState = savedState JS: savedState = docRef.activeHistoryState; docRef.applyMotionBlur( 20, 20 ); docRef.activeHistoryState = savedState; Photoshop 7.0 Scripting Guide 80

  • 1
  • 2
  • 3
  • 4
  • 5
  • 6
  • 7
  • 8
  • 9
  • 10
  • 11
  • 12
  • 13
  • 14
  • 15
  • 16
  • 17
  • 18
  • 19
  • 20
  • 21
  • 22
  • 23
  • 24
  • 25
  • 26
  • 27
  • 28
  • 29
  • 30
  • 31
  • 32
  • 33
  • 34
  • 35
  • 36
  • 37
  • 38
  • 39
  • 40
  • 41
  • 42
  • 43
  • 44
  • 45
  • 46
  • 47
  • 48
  • 49
  • 50
  • 51
  • 52
  • 53
  • 54
  • 55
  • 56
  • 57
  • 58
  • 59
  • 60
  • 61
  • 62
  • 63
  • 64
  • 65
  • 66
  • 67
  • 68
  • 69
  • 70
  • 71
  • 72
  • 73
  • 74
  • 75
  • 76
  • 77
  • 78
  • 79
  • 80
  • 81
  • 82
  • 83
  • 84
  • 85
  • 86
  • 87
  • 88
  • 89
  • 90
  • 91

Photoshop 7.0 Scripting Guide
80
Scripting Photoshop
History object
3
3.15 History object
Photoshop keeps a history of the actions that affect the appearance of documents. Each entry
in the Photoshop History palette is considered a “History State.” These states are accessable
from document object and can be used to reset the document to a previous state. A history state
can also be used to fill a selection.
To set your document back to a particular state, set the document's current history state:
AS:
set current history state of current document to history state 1 ¬
of current document
VB:
docRef.ActiveHistoryState = docRef.HistoryStates(1)
JS:
docRef.activeHistoryState = docRef.historyStates[0];
The code above sets the current history state to the top history state that is in the History
palette. Using history states in this fashion give you the ability to undo the actions that were
taken to modify the document.
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 document using motion blur with options ¬
{angle:20, radius: 20}
set current history state of current document to savedState
VB:
Set savedState = docRef.ActiveHistoryState
docRef.ApplyMotionBlur 20, 20
docRef.ActiveHistoryState = savedState
JS:
savedState = docRef.activeHistoryState;
docRef.applyMotionBlur( 20, 20 );
docRef.activeHistoryState = savedState;