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

Is there any way to move the time indicator of timeline to first frame of the layer using Photoshop script?

Community Beginner ,
Jun 11, 2018 Jun 11, 2018

Copy link to clipboard

Copied

Currently, I am using following script to move time indicator between keyframes.

function next_key_frame() {

var d1 = new ActionDescriptor();

var d2 = new ActionDescriptor();

d2.putEnumerated( stringIDToTypeID( "trackID" ), stringIDToTypeID( "stdTrackID" ), stringIDToTypeID( "opacityTrack" ) );

d1.putObject( stringIDToTypeID( "trackID" ), stringIDToTypeID( "animationTrack" ), d2 );

executeAction( stringIDToTypeID( "nextKeyframe" ), d1, DialogModes.NO );

}

function prev_key_frame() {

    var d1 = new ActionDescriptor();

    var d2 = new ActionDescriptor();

    d2.putEnumerated( stringIDToTypeID( "trackID" ), stringIDToTypeID( "stdTrackID" ), stringIDToTypeID( "opacityTrack" ) );

    d1.putObject( stringIDToTypeID( "trackID" ), stringIDToTypeID( "animationTrack" ), d2 );

    executeAction( stringIDToTypeID( "previousKeyframe" ), d1, DialogModes.NO );

}

But Now, I want to move the time indicator from 0th frame to the first frame of the Layer 2 directly using Photoshop script. Is there any way to do this?

From:

Capture2.PNG

To:

Capture.PNG

TOPICS
Actions and scripting

Views

3.0K

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
Adobe
Valorous Hero ,
Jun 11, 2018 Jun 11, 2018

Copy link to clipboard

Copied

I have never worked with animation or timeline. But if you provide a simplified file with layers and your animation, I can try to do what you need if it works and I will have time for it.

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
Community Beginner ,
Jun 12, 2018 Jun 12, 2018

Copy link to clipboard

Copied

scene.psd - Google Drive

r-bin this the animation file

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
Valorous Hero ,
Jun 12, 2018 Jun 12, 2018

Copy link to clipboard

Copied

OK. Not enough time to analyze. Here is a simplified script (only for CC2018 (2015.5 +)

Make the layer Layer2 activeLayer and run the script.

The script moves the frame from zero until the "Free Transform" command becomes available. This is the appearance time of the Layer2 layer

var d = new ActionDescriptor();

var r = new ActionReference();

r.putProperty(stringIDToTypeID("property"), stringIDToTypeID("time"));

r.putClass(stringIDToTypeID("timeline"));

d.putReference(stringIDToTypeID("null"), r);

var d1 = new ActionDescriptor();

d1.putInteger(stringIDToTypeID("seconds"), 0);

d1.putInteger(stringIDToTypeID("frame"), 0);

d1.putDouble(stringIDToTypeID("frameRate"), 30);

d.putObject(stringIDToTypeID("to"), stringIDToTypeID("timecode"), d1);

executeAction(stringIDToTypeID("set"), d, DialogModes.NO);

var cycle_cnt = 0;

while (cycle_cnt < 1000)

    {

    next_frame();

    if (is_transform_enabled()) break;

    ++cycle_cnt;

    }

function next_frame()

    {

    try {

        var d = new ActionDescriptor();

        d.putBoolean(stringIDToTypeID("toNextWholeSecond"), false);

        executeAction(stringIDToTypeID("nextFrame"), d, DialogModes.NO);

        }

    catch (e) { throw(e); }

    }

function is_transform_enabled()

    {

    var r = new ActionReference();       

    r.putEnumerated(charIDToTypeID("capp"), charIDToTypeID("Ordn"), charIDToTypeID("Trgt"));   

     

    var d = new ActionDescriptor(); 

    d.putReference( charIDToTypeID( "null" ), r );   

    d.putString (stringIDToTypeID("command"), "getCommandEnabled");   

    d.putDouble(stringIDToTypeID("commandID"), 2207 );   

     

    var ret = executeAction(stringIDToTypeID("uiInfo"), d, DialogModes.NO).getObjectValue(stringIDToTypeID("result")).getBoolean(stringIDToTypeID("enabled")); 

    return ret;

    }

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
Community Beginner ,
Jun 12, 2018 Jun 12, 2018

Copy link to clipboard

Copied

Thanks a lot r-bin.
The script is works on Photoshop 2017 CC. But I want to use this script on Photoshop 2014 CC, 2015.5 CC and 2017 CC.

Is there any way to get the offset frames count directly using script?

1.png

If it is possible, we can easily move the indicator to start frame of the layer using following script.

function gotoFrame(frame) {

    var desc1 = new ActionDescriptor();

    var ref = new ActionReference();

    ref.putProperty(charIDToTypeID('Prpr'), stringIDToTypeID('time'));

    ref.putClass(stringIDToTypeID('timeline'));

    desc1.putReference(charIDToTypeID('null'), ref);

    var desc2 = new ActionDescriptor();

    desc2.putInteger(stringIDToTypeID('frame'), frame);

    desc1.putObject(charIDToTypeID('T  '), stringIDToTypeID('timecode'), desc2);

    executeAction(charIDToTypeID('setd'), desc1, DialogModes.NO);

  };

gotoFrame(offset_frames_count - 1);

I have moved the timeline of the layer 2

from:

2.PNG

to:

3.png

Above action generated following script via script listener

var idmoveAllTime = stringIDToTypeID( "moveAllTime" );

var desc8 = new ActionDescriptor();

var idtimeOffset = stringIDToTypeID( "timeOffset" );

var desc9 = new ActionDescriptor();

var idseconds = stringIDToTypeID( "seconds" );

desc9.putInteger( idseconds, 1 );

var idframe = stringIDToTypeID( "frame" );

desc9.putInteger( idframe, 29 );

var idframeRate = stringIDToTypeID( "frameRate" );

desc9.putDouble( idframeRate, 30.000000 );

var idtimecode = stringIDToTypeID( "timecode" );

desc8.putObject( idtimeOffset, idtimecode, desc9 );

executeAction( idmoveAllTime, desc8, DialogModes.NO );

Can we modify above code to get Offset time or frames?

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
Valorous Hero ,
Jun 13, 2018 Jun 13, 2018

Copy link to clipboard

Copied

OK. Here is the version that works even in CS6.

Replace the function is_transform_enabled() with this one.

function is_transform_enabled()

    {

    try { activeDocument.activeLayer.resize(100); } catch(e) { return false; }

    return true;

    }

PS.Although all this is very stupid.

Now there is no way to get information about animation using scripts.

Photoshop allows you to change many parameters, but does not allow them to read.

This applies not only to animation.

Still there is a variant to read the data directly from the PSD file.

But it takes time to sort it out and I'm not sure that it is necessary and convenient.

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
Community Beginner ,
Jul 11, 2018 Jul 11, 2018

Copy link to clipboard

Copied

I have tried is_transform_enabled()  function in Photoshop CC 2015.5 and 2017.
It gives following popup error message.

Capture.PNG

Is there any way to avoid this message box?

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
Valorous Hero ,
Jul 11, 2018 Jul 11, 2018

Copy link to clipboard

Copied

Unsuccessful way. But to remove this error you need to do this way

function is_transform_enabled() 

    { 

    app.displayDialogs = DialogModes.NO;

    try { activeDocument.activeLayer.resize(100); } catch(e) { return false; } 

    return true; 

    } 

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
Community Beginner ,
Jul 16, 2018 Jul 16, 2018

Copy link to clipboard

Copied

Thank you r-bin

activeDocument.activeLayer.resize(100);

Doesn't this effect on the size of the layer ( Eg:- a Smart object which resized to 50%)

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
Valorous Hero ,
Jul 16, 2018 Jul 16, 2018

Copy link to clipboard

Copied

Do not quite understand. For a smart object, it also works and does not change its actual size regardless of its real scale.

By the way, you can use this variant as well

activeDocument.activeLayer.resize();

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
Guide ,
Jun 13, 2018 Jun 13, 2018

Copy link to clipboard

Copied

Brilliant work br r-bin​ and a spin off from the routine is that you can get the frame number if you need it for further processing...

var cycle_cnt = 0; 

var currentFrame = 0;

while (cycle_cnt < 1000) 

    { 

    next_frame(); 

    currentFrame++;

    if (is_transform_enabled()) break; 

 

    ++cycle_cnt; 

    } 

alert(currentFrame);

Trying to get the frame number direct will only return 0-30 (framerate)

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
Valorous Hero ,
Jun 13, 2018 Jun 13, 2018

Copy link to clipboard

Copied

It is possible and so, if I understood correctly )

var r = new ActionReference(); 

r.putProperty(stringIDToTypeID("property"), stringIDToTypeID("currentFrame")); 

r.putClass(stringIDToTypeID("timeline")); 

alert(executeActionGet(r).getInteger(stringIDToTypeID("currentFrame")));

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
Guide ,
Jun 13, 2018 Jun 13, 2018

Copy link to clipboard

Copied

Thank you I had missed that!

I was just testing a binary chop approach to see if was any faster....

main();

function main(){

app.displayDialogs = DialogModes.NO;

//set to end using huge numbers

setToFrameAndTime(20000, 20000, 30);

var FC = getCurrentFrame();

MAX = FC;

MIN = 0;

while( (MAX - MIN) >1){

F = Math.floor(((MAX - MIN)/2)+MIN);

gotoFrame(F);

var result = isActive();

if(result){

    MAX=F;

    }else{

        MIN=F;

        }

}

gotoFrame(MAX);

alert("Frame No: " + getCurrentFrame());

}

function isActive(){ 

try {activeDocument.activeLayer.resize(100); } catch(e) { return false; } 

return true; 

};

function gotoFrame(frame) { 

var desc1 = new ActionDescriptor(); 

var ref = new ActionReference(); 

ref.putProperty(charIDToTypeID('Prpr'), stringIDToTypeID('time')); 

ref.putClass(stringIDToTypeID('timeline')); 

desc1.putReference(charIDToTypeID('null'), ref); 

var desc2 = new ActionDescriptor(); 

desc2.putInteger(stringIDToTypeID('frame'), frame); 

desc1.putObject(charIDToTypeID('T   '), stringIDToTypeID('timecode'), desc2); 

executeAction(charIDToTypeID('setd'), desc1, DialogModes.NO); 

}; 

function getCurrentFrame(){

var r = new ActionReference();   

r.putProperty(stringIDToTypeID("property"), stringIDToTypeID("currentFrame"));   

r.putClass(stringIDToTypeID("timeline"));   

return executeActionGet(r).getInteger(stringIDToTypeID("currentFrame"));

};

function setToFrameAndTime(seconds, frame, frameRate){

var d = new ActionDescriptor(); 

var r = new ActionReference(); 

r.putProperty(stringIDToTypeID("property"), stringIDToTypeID("time")); 

r.putClass(stringIDToTypeID("timeline")); 

d.putReference(stringIDToTypeID("null"), r); 

var d1 = new ActionDescriptor(); 

d1.putInteger(stringIDToTypeID("seconds"), seconds); 

d1.putInteger(stringIDToTypeID("frame"), frame); 

d1.putDouble(stringIDToTypeID("frameRate"),Number( frameRate)); 

d.putObject(stringIDToTypeID("to"), stringIDToTypeID("timecode"), d1); 

executeAction(stringIDToTypeID("set"), d, DialogModes.NO); 

};

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
Explorer ,
Jun 11, 2018 Jun 11, 2018

Copy link to clipboard

Copied

The following method will allow you to move the time indicator to a specific place, but I couldn't figure out how (via script or the GUI) to grab the timestamp of a particular key frame. If you know how to do that it should be easy to then use the method below for the purpose you described (I don't know if PS provides that functionality or not).

As r-bin mentioned, if you provided a sample .psd file it might help.

#target photoshop

setTimelineTime(2, 25, 30);

function setTimelineTime(seconds, frame, frameRate) {

    var timelineReference = new ActionReference();

    timelineReference.putProperty( s2t( "property" ), s2t( "time" ));

    timelineReference.putClass( s2t( "timeline" ));

  

    var timeDescriptor = new ActionDescriptor();

    timeDescriptor.putInteger( s2t( "seconds" ), seconds );

    timeDescriptor.putInteger( s2t( "frame" ), frame );

    timeDescriptor.putDouble( s2t( "frameRate" ), frameRate );

  

    var timelineDescriptor = new ActionDescriptor();

    timelineDescriptor.putReference( c2t( "null" ), timelineReference );

    timelineDescriptor.putObject( s2t( "to" ), s2t( "timecode" ), timeDescriptor );

    executeAction( s2t( "set" ), timelineDescriptor, DialogModes.NO );

    }

function c2t (c) {

    return app.charIDToTypeID(c);

    }

function s2t (s) {

    return app.stringIDToTypeID(s);

    }

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
Valorous Hero ,
Jun 13, 2018 Jun 13, 2018

Copy link to clipboard

Copied

For your file there is a solution provided that the Layer2 animation ends no later than the animation of the other layers

Works even in CS6.

//if (get_curr_frame()) runMenuItem(stringIDToTypeID("timelineGoToFirstFrame")); // bad variant

goto_frame(0);

var x1 = get_frame_count();

runMenuItem(stringIDToTypeID("timelineMoveLayerInPoint"))

var x2 = get_frame_count();

executeAction(charIDToTypeID("undo"), undefined, DialogModes.NO);

goto_frame(x1-x2);

function get_curr_frame()

    {

    var r = new ActionReference();   

    r.putProperty(stringIDToTypeID("property"), stringIDToTypeID("currentFrame"));   

    r.putClass(stringIDToTypeID("timeline"));   

    return executeActionGet(r).getInteger(stringIDToTypeID("currentFrame")); 

    }

function get_frame_count()

    {

    var r = new ActionReference();   

    r.putProperty(stringIDToTypeID("property"), stringIDToTypeID("frameCount"));   

    r.putClass(stringIDToTypeID("timeline"));   

    return executeActionGet(r).getInteger(stringIDToTypeID("frameCount")); 

    }

function goto_frame(f)

    {

    var d = new ActionDescriptor(); 

    var r = new ActionReference(); 

    r.putProperty(stringIDToTypeID("property"), stringIDToTypeID("time")); 

    r.putClass(stringIDToTypeID("timeline")); 

    d.putReference(stringIDToTypeID("null"), r); 

    var d1 = new ActionDescriptor(); 

    d1.putInteger(stringIDToTypeID("frame"), f); 

    d.putObject(stringIDToTypeID("to"), stringIDToTypeID("timecode"), d1); 

    executeAction(stringIDToTypeID("set"), d, DialogModes.NO); 

    }

PS. In general, it is necessary to duplicate the document. Delete all layers in it except activeLayer. Run the script to get (x1-x2). And in the original document do positioning on the frame (x1-x2).

I have not found the best yet.

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
Community Beginner ,
Nov 07, 2018 Nov 07, 2018

Copy link to clipboard

Copied

Thanks r-bin​  for that excellent suggestion.    Unfortunately when dealing with longer videos,  moving through each frame to check for the enabled transforms is very slow.   it works!  but trying to come up with something faster. 

Any other suggestions on how to locate the start time position of a layer in the timeline panel?

I've been digging around in the descriptors and just can't find anything.

The only other option I can think of is to add an event watcher,  and track the position of the layer as moveInPoint, moveOutPoints and moveAllTime events happen... but that seems so overly complicated when I just need to extract that number that I know Photoshop knows already.  Reaching out to community for suggestions.

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
Valorous Hero ,
Nov 08, 2018 Nov 08, 2018

Copy link to clipboard

Copied

I know almost nothing about animation and I don’t use it.

But the proposed method can be significantly accelerated by doing so.

var r = new ActionReference();

r.putProperty(stringIDToTypeID("property"), stringIDToTypeID("frameCount")); 

r.putClass(stringIDToTypeID("timeline"));

var max_frame = executeActionGet(r).getInteger(stringIDToTypeID("frameCount"));

var step = max_frame/2;

var frame = Math.round(step);

var end_cnt = 0;

 

while (1) 

    { 

    goto_frame(frame); 

    step = Math.round(step/2);

 

    if (is_transform_enabled()) { if (step == 1) break; frame -= step; }

    else frame += step;

    if (step <= 1) ++end_cnt;

    if (end_cnt > 2) break;

    } 

function goto_frame(n) 

    { 

    try { 

        var d = new ActionDescriptor(); 

        var r = new ActionReference(); 

        r.putProperty(stringIDToTypeID("property"), stringIDToTypeID("time")); 

        r.putClass(stringIDToTypeID("timeline")); 

        d.putReference(stringIDToTypeID("null"), r); 

        var d1 = new ActionDescriptor(); 

        d1.putInteger(stringIDToTypeID("frame"), n); 

        d.putObject(stringIDToTypeID("to"), stringIDToTypeID("timecode"), d1); 

        executeAction(stringIDToTypeID("set"), d, DialogModes.NO); 

        } 

    catch (e) { throw(e); }  

    } 

function is_transform_enabled() // version for CS6

    { 

    try { activeDocument.activeLayer.resize(100); } catch(e) { return false; } 

    return true; 

    } 

But I do not guarantee that it does exactly what you want. 🙂

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
Community Beginner ,
Nov 08, 2018 Nov 08, 2018

Copy link to clipboard

Copied

Thanks!  I'll give it a try!  

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
Valorous Hero ,
Nov 11, 2018 Nov 11, 2018

Copy link to clipboard

Copied

For a high-quality script, you need a full-fledged algorithm for parsing a psd file.

This simple script does not do this, but it works (in CS6 too).

Check.

You can uncomment lines for positioning to Layer outTime.

var r = new ActionReference();   

r.putProperty(stringIDToTypeID("property"), stringIDToTypeID("layerID"));

r.putEnumerated(stringIDToTypeID("layer"), stringIDToTypeID("ordinal"), stringIDToTypeID("targetEnum"));

var layer_id = executeActionGet(r).getInteger(stringIDToTypeID("layerID"));

var r = new ActionReference();   

r.putProperty(stringIDToTypeID("property"), stringIDToTypeID("frameRate"));

r.putEnumerated(stringIDToTypeID("timeline"), stringIDToTypeID("ordinal"), stringIDToTypeID("targetEnum"));

var frame_rate = executeActionGet(r).getInteger(stringIDToTypeID("frameRate"));

var file = activeDocument.fullName; 

 

activeDocument.save(); 

 

file.open("r"); 

file.encoding = "BINARY"; 

 

var len = file.length; 

 

if (len > 200000) len = 200000; 

 

var buff = file.read(len); 

file.close();

 

while(1)

    {

    var n = buff.indexOf("8BIMtmln"); 

   

    if (n >= 0)

        {

        var d = new ActionDescriptor(); 

        d.fromStream(buff.substr(n+16)) 

        if (layer_id == d.getInteger(stringIDToTypeID("layerID")))

            {

            var n1 = d.getObjectValue(stringIDToTypeID("timeScope")).getObjectValue(stringIDToTypeID("inTime")).getInteger(stringIDToTypeID("numerator"));

            var n2 = d.getObjectValue(stringIDToTypeID("timeScope")).getObjectValue(stringIDToTypeID("inTime")).getInteger(stringIDToTypeID("denominator"));

            //var n1 = d.getObjectValue(stringIDToTypeID("timeScope")).getObjectValue(stringIDToTypeID("outTime")).getInteger(stringIDToTypeID("numerator"));

            //var n2 = d.getObjectValue(stringIDToTypeID("timeScope")).getObjectValue(stringIDToTypeID("outTime")).getInteger(stringIDToTypeID("denominator"));

            var frame = n1/n2*frame_rate;

            var d = new ActionDescriptor();

            var r = new ActionReference();

            r.putProperty(stringIDToTypeID("property"), stringIDToTypeID("time"));

            r.putClass(stringIDToTypeID("timeline"));

            d.putReference(stringIDToTypeID("null"), r);

            var d1 = new ActionDescriptor();

            d1.putInteger(stringIDToTypeID("seconds"), 0);

            d1.putInteger(stringIDToTypeID("frame"), frame);

            d1.putDouble(stringIDToTypeID("frameRate"), frame_rate);

            d.putObject(stringIDToTypeID("to"), stringIDToTypeID("timecode"), d1);

            executeAction(stringIDToTypeID("set"), d, DialogModes.NO);

            break;

            }

        buff = buff.substr(n+8);

        }

    else

        {

        alert("ActiveLayer TimeLine not found");

        break;

        }   

    }       

edit: Fixed the script

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
Participant ,
Nov 12, 2018 Nov 12, 2018

Copy link to clipboard

Copied

ohh.. you got good magic there - I wasn't familiar with the "timeScope" key. But unfortunately it doesn't seem to be working for me.   (tested in CC2017 and CC2019)  Very interesting how you're able read the file into a stream buffer though,  good trick.

Thanks for the suggestion on post #16, ... I was starting to work on something similar where I hop around and check for a menu enabled.  ... but it wasn't as clean as your code. very appreciated. 

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
Valorous Hero ,
Nov 13, 2018 Nov 13, 2018

Copy link to clipboard

Copied

OK. This is most likely a very large file. Here, try a script with a normal parser. Works in CC2018. Checked!

The file format must be PSD or PSB.

eval("@JSXBIN@ES@2.0@MyBbyBnACMCbyBn0ABgEbyBn0AFJFnASzDjMjFjOBAXzGjMjFjOjHjUjICfVzBjTDfEnftJHnASzEjNjVjMjUEBndBftJInASzDjSjFjUFCndAftKKbMn0ACJMnASFCCzBhLGnCzBhKHEXzKjDjIjBjSiDjPjEjFiBjUIfVDfERBVzBjJJfDffVEfBnnnnntfJNnASEBCHnnnd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0AiAhf4I0AiAD4O0AiAge40BiAiH4J0AiAiK4K0AiAiL4L0AiAiM4M0AiAiN4N0AiAiQ4P0AiAiR4Q0AiAha4G0AiAhA4B0AiAgf4C0AiAhC4D0AiAhD4E0AiAB4R0AiAATAhVCnVnfJnYnABXzRjHjFjUifjUjJjNjFjMjJjOjFifjEjFjTjDicf"+

"XZfjXfNyBnAMnYbyBn0ABgnabyBn0ABanbbyndn0ABOndbynfn0ABZnfnAXiSfQhVfXhTfeQfVJf0AChEXiPfQhVfXhTfeQfVJfAViPfBnnnAVJf0AXhOfeQfByBhdABnMnbyBn0ABJ2DBnAEjNfRBjMfffACJ40BiAiP40BhABBAhVC2EBnf0DhVByB");

var r = new ActionReference();     

r.putProperty(stringIDToTypeID("property"), stringIDToTypeID("layerID")); 

r.putEnumerated(stringIDToTypeID("layer"), stringIDToTypeID("ordinal"), stringIDToTypeID("targetEnum")); 

var layer_id = executeActionGet(r).getInteger(stringIDToTypeID("layerID"));

var r = new ActionReference();     

r.putProperty(stringIDToTypeID("property"), stringIDToTypeID("frameRate")); 

r.putEnumerated(stringIDToTypeID("timeline"), stringIDToTypeID("ordinal"), stringIDToTypeID("targetEnum")); 

var frame_rate = executeActionGet(r).getInteger(stringIDToTypeID("frameRate")); 

var p = new PSD_Parser(activeDocument);

if (p.parse())

    {  

    var d = p.get_timeline_desc(layer_id);

    if (d)

        {

        var n1 = d.getObjectValue(stringIDToTypeID("timeScope")).getObjectValue(stringIDToTypeID("inTime")).getInteger(stringIDToTypeID("numerator")); 

        var n2 = d.getObjectValue(stringIDToTypeID("timeScope")).getObjectValue(stringIDToTypeID("inTime")).getInteger(stringIDToTypeID("denominator")); 

        //var n1 = d.getObjectValue(stringIDToTypeID("timeScope")).getObjectValue(stringIDToTypeID("outTime")).getInteger(stringIDToTypeID("numerator")); 

        //var n2 = d.getObjectValue(stringIDToTypeID("timeScope")).getObjectValue(stringIDToTypeID("outTime")).getInteger(stringIDToTypeID("denominator")); 

        var frame = n1/n2*frame_rate; 

        var d = new ActionDescriptor(); 

        var r = new ActionReference(); 

        r.putProperty(stringIDToTypeID("property"), stringIDToTypeID("time")); 

        r.putClass(stringIDToTypeID("timeline")); 

        d.putReference(stringIDToTypeID("null"), r); 

        var d1 = new ActionDescriptor(); 

        d1.putInteger(stringIDToTypeID("seconds"), 0); 

        d1.putInteger(stringIDToTypeID("frame"), frame); 

        d1.putDouble(stringIDToTypeID("frameRate"), frame_rate); 

        d.putObject(stringIDToTypeID("to"), stringIDToTypeID("timecode"), d1); 

        executeAction(stringIDToTypeID("set"), d, DialogModes.NO); 

        }

    else

        {

        alert("ActiveLayer TimeLine not found"); 

        }

    }       

else

    {

    alert("Failed!");

    }

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
Community Beginner ,
Nov 13, 2018 Nov 13, 2018

Copy link to clipboard

Copied

Unfortunatly Still not working, the file is very small (only 42k)  just 2 simple layers with timeline properties.  I'm getting a "Layer Blend Mode" parse Error this time.   I'm on Windows if that makes a difference, and this was in CC 2018.  I'll test on Mac... 

I'd love to learn more about you're parsing trick!  looks very handy.  Thanks for your assistance.

Capture.JPG

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
Valorous Hero ,
Nov 13, 2018 Nov 13, 2018

Copy link to clipboard

Copied

Could you give me your file for research?

I am still debugging my parser and I don’t want to open its code yet.

I use this information to parse a file. Adobe Photoshop File Formats Specification

You can try to understand the file structure yourself if you want. )

Layer TimeLineInfo is located in the layer metadata section "8BIMshmd" in the "8BIMtmln" subsection.
Unfortunately, through AM-code, it is possible to read layer metadata only for the "8BIMcust" subsection containing data such as layerXMP and layerTime.

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
Community Beginner ,
Nov 13, 2018 Nov 13, 2018

Copy link to clipboard

Copied

File is here: Dropbox - test.psd

Let me know if you need any additional testing.

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
Valorous Hero ,
Nov 13, 2018 Nov 13, 2018

Copy link to clipboard

Copied

Ok. Thank you!

You found a bug at me.

I made a change in the code at the last moment and this resulted in a negative number of layers for your file. In addition, I found another inaccuracy in determining the start of the layer.

Check. Now it works for me with your file )

eval("@JSXBIN@ES@2.0@MyBbyBnAEMAbyBn0ABJAnAEjzFjBjMjFjSjUBfRDVzBjFCfAFeFiFjSjSjPjSFctffABC40BhAB0AzGifjBjMjFjSjUD0AMDbyBn0ABgFbyBn0AFJGnASzDjMjFjOEAXzGjMjFjOjHjUjIFfVzBjTGfEnftJInASzEjNjVjMjUHBndBftJJnASzDjSjFjUICndAftKLbNn0ACJNnASICCzBhLJnCzBhKKEXzKjDjIjBjSiDjPjEjFiBjULfVGfERBVzBjJMfDffVHfBnnnnntfJOnASHBCKnnnd2ABntfASMDC"+

"zBhNNVEfAnndBnftCzChehdOVMfDnndATMDyBtZRnAVIfCABnCnbyBn0ABJTnAEjDfRBjCfffAFM4D0AiAG40BhAH4B0AiAI4C0AiAE40BiABEAzMifjHjFjUifjJjOjUjFjHjFjSPAUMXbyBn0ABgZbyBn0AFOgaJganASEGndBffACzChdhdQVEfGjzJjVjOjEjFjGjJjOjFjERfnnnJgcnASIAAnnftagebhAn0AFJhAnASzCjDhQSCEXLfVGfFRBCJnVMfBdAnffnftJhBnASzCjDhRTDEXLfVGfFRBCJnVMfBdBnffnftJh"+

"DnASzDjWjBjMUECJVTfDCKnVSfCd2ABnnnnftOhFJhFnASUEhzBhNVCJCNnVUfEd2nfnfnnndBnffACzBhGWVSfCnndkAnJhHnAEXzEjQjVjTjIXfVIfARBVUfEffAVMfBACKnVEfGdCnCyBzBhcYOhKZhKnAXzBhQZfVIf0ACQVEfGnndBnZhMnAVIf0ABnCnbyBn0ABJhOnAEjDfRBjCfffAHU4E0AiAM4B0A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gefCnfAChKVgefCjzEiGjJjMjFhMfnnnABnCnbyBn0ABJiVnAEjDfRBjCfffADge40BhAgf40BiAhF4B0AiABCAzKiQiTiEifiQjBjSjTjFjShNAiWCJiZnABXzFjQjBjSjTjFhOfXzJjQjSjPjUjPjUjZjQjFhPfjhNfNyBnAMiZbyBn0ABgibbyBn0AhDOicgyicbyBn0ABJicnAEXzEjTjBjWjFhQfXgdfegcfnfABnCnbyBn0ACJyicnAEjBfRDjCfXgbfegcfFctffZy"+

"icnAFcfAXgdfegcfnOieZienAFcfAhzBhBhRXgefegcfnJjAnAEXzEjPjQjFjOhSfXgefegcfRBFeBjSffJjBnABXzIjFjOjDjPjEjJjOjHhTfXgefegcfneGiCiJiOiBiSiZfOjDbyjDn0ACJjDnAEjBfRDXzFjFjSjSjPjShUfXgefegcfXgbfegcfFctffZyjDnAFcfAXhUfXgefegcfnJjFnASzGjPjGjGjTjFjUhVAndAftJjInASzHjIjSjEifjMjFjOhWCndgaftJjKnASzEjCjVjGjGhXBEXzEjSjFjBjEhYfXgefegc"+

"fRBVhWfCffnffJjLnAShVACJnVhWfCnnntfJjNnASzDjQjTjChZDncfftJjOnASzDjQjTjEhaEncfftOjQJjQnAShaEnctffACQEXzGjTjVjCjTjUjShbfVhXfBRCFdAFdMffnneMhYiCiQiTAB0EnOjRJjRnAShZDnctffACQEXhbfVhXfBRCFdAFdMffnneMhYiCiQiTAC0EnOjTbyjTn0ADJjTnAEXzFjDjMjPjTjFhcfXgefegcfnfJyjTnAEjBfRDFeViXjSjPjOjHhAiQiTiEhPiQiTiChAjIjFjBjEjFjShBXgbfegcfF"+

"ctffZyjTnAFcfAUzChGhGhdhhRVhafEhhRVhZfDnnnJjVnABXzOjDjPjMjPjSifjNjPjEjFifjMjFjOhefegcfEjPfRBEXhYfXgefegcfRBFdEffffnfJjWnAShVACJnCJnXhefegcfdEnnnntfJjYnAEXzEjTjFjFjLhffXgefegcfRCVhVfAFdAffJjanABXzSjJjNjBjHjFifjSjFjTjPjVjSjDjFifjMjFjOiAfegcfEjPfRBEXhYfXgefegcfRBFdEffffnfJjbnAShVACJnCJnXiAfegcfdEnnnntfJjdnAEXhffXgefeg"+

"cfRCVhVfAFdAffJjfnABXzOjMjBjZjFjSifjTjFjDjUifjMjFjOiBfegcfEjPfRBEXhYfXgefegcfRBdVhZfDFdIFdEffffnfJkAnABXzOjMjBjZjFjSifjJjOjGjPifjMjFjOiCfegcfEjPfRBEXhYfXgefegcfRBdVhZfDFdIFdEffffnfJkBnABXzLjMjBjZjFjSifjDjPjVjOjUiDfegcfEjgafRBEXhYfXgefegcfRBFdCffffnfJkDnABXzYjHjMjPjCifjMjBjZjFjSifjNjBjTjLifjJjOjGjPifjQjPjTiEfegcfCJC"+

"JVhVfAXiCfegcfnndVhZfDFdQFdInnnfJkEnABXzOjJjNjBjHjFifjEjBjUjBifjQjPjTiFfegcfCJCJVhVfAXiBfegcfnndVhZfDFdIFdEnnnfJkGnABXiDfegcfEXzDjBjCjTiGfjzEiNjBjUjIiHfRBXiDfegcfffnfJkInAShVACJndVhZfDFdSFdKnnntfJkKnABXzGjMjBjZjFjSjTiIfegcfEjzFiBjSjSjBjZiJfntnfJkMnAEXhffXgefegcfRCVhVfAFdAffakObkQn0AgfJkQnABQhIfXiIfegcfVMfFEjzGiPjCj"+

"KjFjDjUiKfntnfJkSnABXzGjCjPjVjOjEjTiLfQhIfXiIfegcfVMfFAREEjPfRBEXhYfXgefegcfRBFdEffffEjPfRBEXhYfXgefegcfRBFdEffffEjPfRBEXhYfXgefegcfRBFdEffffEjPfRBEXhYfXgefegcfRBFdEfffffnfJkTnAShVACJnnndQntfJkVnABXzOjMjBjZjFjSifjDjIjBjOjOjFjMjTiMfQhIfXiIfegcfVMfFEjPfRBEXhYfXgefegcfRBFdCffffnfJkWnAShVACJnnndCntfJkYnABXzMjDjIjBjOjOj"+

"FjMifjJjOjGjPiNfQhIfXiIfegcfVMfFEjiJfntnfakabkcn0AEJkcnABQhIfXiNfQhIfXiIfegcfVMfFVzBjOiOfGEjiKfntnfJkdnABXzKjDjIjBjOjOjFjMifjJjEiPfQhIfXiNfQhIfXiIfegcfVMfFViOfGEjPfRBEXhYfXgefegcfRBFdCffffnfJkenABXzQjDjIjBjOjOjFjMifjEjBjUjBifjMjFjOiQfQhIfXiNfQhIfXiIfegcfVMfFViOfGEjPfRBEXhYfXgefegcfRBdVhZfDFdIFdEffffnfJkfnAShVACJndV"+

"hZfDFdKFdGnnntfAViOfGAXiMfQhIfXiIfegcfVMfFByBYJlCnASzLjDjIifjJjOjGjPifjMjFjOiRHCKnXiMfQhIfXiIfegcfVMfFdGnnftJlEnASzKjCjNjPjEjFifjTjJjHjOiSIEXhYfXgefegcfRBFdEffnftJlFnAShVACJnnndEntfOlHbylHn0ADJlHnAEXhcfXgefegcfnfJylHnAEjBfRDCJnEXzLjUjPiVjQjQjFjSiDjBjTjFiTfEXzIjUjPiTjUjSjJjOjHiUfVhVfARBFdQffnfehGiMjBjZjFjShAiCjMjFjO"+

"jEhAiNjPjEjFhAjQjBjSjTjFhAjFjSjSjPjShBKKiPiGiGiTiFiUhdnXgbfegcfFctffZylHnAFcfACzChBhdiVViSfInneEhYiCiJiNnJlJnABXzKjCjMjFjOjEifjNjPjEjFiWfQhIfXiIfegcfVMfFEXhYfXgefegcfRBFdEffnfJlKnAShVACJnnndEntfJlMnABXzHjPjQjBjDjJjUjZiXfQhIfXiIfegcfVMfFEXLfEXhYfXgefegcfRBFdBffRBFdAffnfJlNnABXzIjDjMjJjQjQjJjOjHiYfQhIfXiIfegcfVMfFEXL"+

"fEXhYfXgefegcfRBFdBffRBFdAffnfJlOnABXzFjGjMjBjHjTiZfQhIfXiIfegcfVMfFEXLfEXhYfXgefegcfRBFdBffRBFdAffnfJlPnAEXhYfXgefegcfRBFdBffJlQnAShVACJnnndEntfJlSnASzIjEjBjUjBifjMjFjOiaJEjPfRBEXhYfXgefegcfRBFdEffffnftJlTnAShVACJnnndEntfJlVnABXzEjEjBjUjBibfQhIfXiIfegcfVMfFEXhYfXgefegcfRBViafJffnfJlWnABXzLjEjBjUjBifjPjGjGjTjFjUicf"+

"QhIfXiIfegcfVMfFVhVfAnfJlXnAShVACJnViafJnnntfJlZnASzCjYhRidKEjPfRBEXhbfXibfQhIfXiIfegcfVMfFRCFdAFdEffffnftJlanASzCjYhSieLEjPfRBEXhbfXibfQhIfXiIfegcfVMfFRCCJVidfKnndEFdEffffnftJlbnASzCjYhTifMEXLfEXhbfXibfQhIfXiIfegcfVMfFRCCJCJVidfKViefLnnnndIFdBffRBFdAffnftJlcnASzCjYhUjANCNnCzBhFjBCJnViffMdBnnndEdEnnftOldJldnASjANnd"+

"AffACQVjAfNnndEnJlfnABXgbfQhIfXiIfegcfVMfFEXhbfXibfQhIfXiIfegcfVMfFRCCJCJVidfKViefLnnnndJViffMffnfJmAnABXibfQhIfXiIfegcfVMfFEXhbfXibfQhIfXiIfegcfVMfFRBCJCJCJCJVidfKViefLnnnndJViffMnnVjAfNnnffnfJmBnABXicfQhIfXiIfegcfVMfFCJnCJCJCJCJVidfKViefLnnnndJViffMnnVjAfNnnnnntAVMfFAXiDfegcfByBYamGbmIn0ADJmInASGOXibfQhIfXiIfegcf"+

"VMfFnftJmKnAShVAXicfQhIfXiIfegcfVMfFnfflmMbymOn0ABOmObmQn0AFcmQnAEXhbfVGfORCFdEFdEffDRBFeEjMjZjJjEfRBFeEjTjIjNjEfRBFeEiTjPiMjEfDbmTn0ACJmTnABXzIjMjBjZjFjSifjJjEjCfQhIfXiIfegcfVMfFEjPfRBEXhbfVGfORCFdMFdEffffnfDmUnAhItbmXn0AFJmXnASzKjNjFjUjBifjDjPjVjOjUjDPEjPfRBEXhbfVGfORCFdMFdEffffnftJmZnASzIjNjFjUjBjEjBjUjBjEQEXhbf"+

"VGfORBFdQffnftJmbnASiOGndAftlmdbmfn0ADOmfbnBn0ACJnBnASEREjPfRBEXhbfVjEfQRCCJViOfGnndMFdEffffnftcnDnAEXhbfVjEfQRCCJViOfGnnd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dAFdEffnneEhYiCiJiNCQEXhbfVGfORCFdAFdEffnneEhYiChWhUnnb2"+

"QBn0ACO2QBb2SBn0ADJ2SBnAEXhcfXgefegcfnfJ2TBnAEjBfRDCJnEXiTfEXiUfVhVfARBFdQffnfehAiMjBjZjFjShAiEjBjUjBhAjQjBjSjTjFhAjFjSjSjPjShBKKiPiGiGiTiFiUhdnXgbfegcfFctffZ2UBnAFcfACiVXFfXibfQhIfXiIfegcfVMfFCNVhVfAXicfQhIfXiIfegcfVMfFnnnnnD2XBnAhItAnAVMfFAXiDfegcfByBYO2gcBby2gcBn0ADJ2gcBnAEXhcfXgefegcfnfJy2gcBnAEjBfRDCJnEXiTfEXi"+

"UfVhVfARBFdQffnfegaiGjJjMjFhAjSjFjBjEhAjFjSjSjPjSjShBKKiPiGiGiTiFiUhdnXgbfegcfFctffZy2gcBnAFcfAXhUfXgefegcfnJ2geBnAEXhcfXgefegcfnfJ2hABnAShXBnbffZ2hCBnAFctABnCnbyBn0ACJ2hEBnAEjDfRBjCfffZy2hEBnAFcfAThV40BiAhX4B0AiAM4F0AiAhW4C0AiAjM4S0AiAhZ4D0AiAha4E0AiAG4O0AiAiR4H0AiAiS4I0AiAia4J0AiAid4K0AiAie4L0AiAif4M0AiAjA4N0AiAj"+

"D4P0AiAiO4G0AiAjE4Q0AiAE4R0AiAATAhIC2hFBnfJ2hIBnABXzRjHjFjUifjUjJjNjFjMjJjOjFifjEjFjTjDjNfXhPfjhNfNyBnAM2hIBbyBn0ABg2hKBbyBn0ABa2hLBby2hNBn0ABO2hNBby2hPBn0ABZ2hPBnAXjFfQhIfXiIfegcfVMf0ACQXjCfQhIfXiIfegcfVMfAVjCfBnnnAVMf0AXiDfegcfByBYABnCnbyBn0ABJ2hTBnAEjDfRBjCfffACM40BiAjC40BhABBAhIC2hUBnf0DhIByB");

var r = new ActionReference();       

r.putProperty(stringIDToTypeID("property"), stringIDToTypeID("layerID"));   

r.putEnumerated(stringIDToTypeID("layer"), stringIDToTypeID("ordinal"), stringIDToTypeID("targetEnum"));   

var layer_id = executeActionGet(r).getInteger(stringIDToTypeID("layerID")); 

 

var r = new ActionReference();       

r.putProperty(stringIDToTypeID("property"), stringIDToTypeID("frameRate"));   

r.putEnumerated(stringIDToTypeID("timeline"), stringIDToTypeID("ordinal"), stringIDToTypeID("targetEnum"));   

var frame_rate = executeActionGet(r).getInteger(stringIDToTypeID("frameRate"));   

 

var p = new PSD_Parser(activeDocument); 

 

if (p.parse()) 

    {    

    var d = p.get_timeline_desc(layer_id); 

    if (d) 

        { 

        var s1 = d.getObjectValue(stringIDToTypeID("timeScope")).getObjectValue(stringIDToTypeID("start")).getInteger(stringIDToTypeID("numerator"));   

        var s2 = d.getObjectValue(stringIDToTypeID("timeScope")).getObjectValue(stringIDToTypeID("start")).getInteger(stringIDToTypeID("denominator"));   

        var n1 = d.getObjectValue(stringIDToTypeID("timeScope")).getObjectValue(stringIDToTypeID("inTime")).getInteger(stringIDToTypeID("numerator"));   

        var n2 = d.getObjectValue(stringIDToTypeID("timeScope")).getObjectValue(stringIDToTypeID("inTime")).getInteger(stringIDToTypeID("denominator"));   

 

        //var n1 = d.getObjectValue(stringIDToTypeID("timeScope")).getObjectValue(stringIDToTypeID("outTime")).getInteger(stringIDToTypeID("numerator"));   

        //var n2 = d.getObjectValue(stringIDToTypeID("timeScope")).getObjectValue(stringIDToTypeID("outTime")).getInteger(stringIDToTypeID("denominator"));   

 

        var frame = (n1/n2 + s1/s2)*frame_rate;   

 

        var d = new ActionDescriptor();   

        var r = new ActionReference();   

        r.putProperty(stringIDToTypeID("property"), stringIDToTypeID("time"));   

        r.putClass(stringIDToTypeID("timeline"));   

        d.putReference(stringIDToTypeID("null"), r);   

        var d1 = new ActionDescriptor();   

        d1.putInteger(stringIDToTypeID("seconds"), 0);   

        d1.putInteger(stringIDToTypeID("frame"), frame);   

        d1.putDouble(stringIDToTypeID("frameRate"), frame_rate);   

        d.putObject(stringIDToTypeID("to"), stringIDToTypeID("timecode"), d1);   

        executeAction(stringIDToTypeID("set"), d, DialogModes.NO);   

        } 

    else 

        { 

        alert("ActiveLayer TimeLine not found");   

        } 

    }         

else 

    { 

    alert("Failed!"); 

    } 

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