Hey,
I am looking for a way to retrieve all historyStates. So far I have found only one variant with which I can retrieve the current historyState
Has anyone found a way?
In CEP I got it like this
app.activeDocument.historyStates
Thanks Joe
Hey,
I am looking for a way to retrieve all historyStates. So far I have found only one variant with which I can retrieve the current historyState
Has anyone found a way?
In CEP I got it like this
app.activeDocument.historyStates
Thanks Joe
In the ActionDescriptor, you can target specific history states via any of the following:
_property: 'currentHistoryState'
_index: *index*
_name: *name*
_id: *id*
for example:
export function getHistoryState(_index?: number, _name?: string): HistoryState {
return photoshop.action.batchPlay({
_obj: 'get',
_target: [
{
_ref: 'historyState',
...(!_index && !_name ? { _property: 'currentHistoryState'}: {}),
...(_index ? {_index} : {}),
...(_name ? {_name} : {})
},
],
_options: {
dialogOptions: 'dontDisplay',
},
}, { synchronousExecution: true })[0]
}
Also, each HistoryStateDescriptor has a property called count
, which is the total amount of history states in the document.
So in order to get all history states you’ll have to do:
count
)Important note: If I remember correctly, history states start at the itemIndex 1, and not at 0.
Thanks Simon,
a little more complicated than in CEP, but it works