Skip to main content
Participating Frequently
April 7, 2013
Answered

Need help with getting current activeHistoryState index

  • April 7, 2013
  • 1 reply
  • 643 views

Hi,

I'd like to get the current activeHistoryState index via JavaScript.

For example, I have a historyStates length of 15 and as a user, I've set the activeHistoryState to index 12.

The number 12 is the index that I would like to query the PS via JavaScript.

I've searched thru' the documentation and couldn't find any.

Is there a way to do so?

Your help is very much appreciated.

This topic has been closed for replies.
Correct answer Michael_L_Hale

The Photoshop Object Model doesn't have the needed properties to determine the active history state. But it can be determined using Action Manager.

function getActiveHistoryStateIndex(){

    var ref = new ActionReference();

    ref.putProperty( charIDToTypeID( 'HstS' ), charIDToTypeID( 'CrnH' ) );

    return executeActionGet(ref).getInteger( charIDToTypeID( 'ItmI' ) );

};

1 reply

Michael_L_HaleCorrect answer
Inspiring
April 7, 2013

The Photoshop Object Model doesn't have the needed properties to determine the active history state. But it can be determined using Action Manager.

function getActiveHistoryStateIndex(){

    var ref = new ActionReference();

    ref.putProperty( charIDToTypeID( 'HstS' ), charIDToTypeID( 'CrnH' ) );

    return executeActionGet(ref).getInteger( charIDToTypeID( 'ItmI' ) );

};

ericpohAuthor
Participating Frequently
April 8, 2013

Thank you Michael. It helps a lot.

Have a nice day!