• Global community
    • Language:
      • Deutsch
      • English
      • Español
      • Français
      • Português
  • 日本語コミュニティ
    Dedicated community for Japanese speakers
  • 한국 커뮤니티
    Dedicated community for Korean speakers
Exit
0

Snapshot help

Contributor ,
Oct 02, 2017 Oct 02, 2017

Copy link to clipboard

Copied

Hello friends! How to check if the current document has a snapshot named "Initial Color"? If it already exists, do nothing, and if it does not exist, add it.

TOPICS
Actions and scripting

Views

850

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines

correct answers 1 Correct answer

Engaged , Oct 02, 2017 Oct 02, 2017

Hi tokuredit,

Hope this will help..

var doc = app.activeDocument;

var hs = doc.historyStates;

var flg=0;

for(var a =hs.length-1;a>=0;--a){

    if(hs.snapshot) {

        if(hs.name=="Initial Color"){

            doc.activeHistoryState = hs;

            delHist();

            flg=1

        }

    }

}

if(flg==0){

// Put your code here.....

}

function delHist() {

    var desc20 = new ActionDescriptor();

    var ref23 = new ActionReference();

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

    des

...

Votes

Translate

Translate
Adobe
Engaged ,
Oct 02, 2017 Oct 02, 2017

Copy link to clipboard

Copied

Hi tokuredit,

Hope this will help..

var doc = app.activeDocument;

var hs = doc.historyStates;

var flg=0;

for(var a =hs.length-1;a>=0;--a){

    if(hs.snapshot) {

        if(hs.name=="Initial Color"){

            doc.activeHistoryState = hs;

            delHist();

            flg=1

        }

    }

}

if(flg==0){

// Put your code here.....

}

function delHist() {

    var desc20 = new ActionDescriptor();

    var ref23 = new ActionReference();

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

    desc20.putReference( charIDToTypeID('null'), ref23 );

    executeAction( charIDToTypeID('Dlt '), desc20, DialogModes.NO );

};

-yajiv

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Contributor ,
Oct 03, 2017 Oct 03, 2017

Copy link to clipboard

Copied

LATEST

Great, it worked very well! I just removed line 8 and the last 7 to work as I need it! Helped me a lot. Thank you very much natrev

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines