Skip to main content
Inspiring
August 23, 2018
Question

My script works as an action but not as a script

  • August 23, 2018
  • 14 replies
  • 940 views

Hi here is the code, it works as an action then when I convert it to script then it just does nothing, this is to go to end of working area in timeline in photoshop

#target photoshop

//

// Set.jsx

//

//

// Generated Thu Aug 23 2018 18:57:29 GMT+0200

//

cTID = function(s) { return app.charIDToTypeID(s); };

sTID = function(s) { return app.stringIDToTypeID(s); };

//

//==================== Set ==============

//

function Set() {

  // Set

  function step1(enabled, withDialog) {

    if (enabled != undefined && !enabled)

      return;

    var dialogMode = (withDialog ? DialogModes.ALL : DialogModes.NO);

    var desc1 = new ActionDescriptor();

    var ref1 = new ActionReference();

    ref1.putProperty(cTID('Prpr'), cTID('time'));

    ref1.putClass(sTID("timeline"));

    desc1.putReference(cTID('null'), ref1);

    var desc2 = new ActionDescriptor();

    desc2.putInteger(sTID("seconds"), 4);

    desc2.putInteger(sTID("frame"), 29);

    desc2.putDouble(sTID("frameRate"), 30);

    desc1.putObject(cTID('T   '), sTID("timecode"), desc2);

    executeAction(cTID('setd'), desc1, dialogMode);

  };

  step1();      // Set

};

//=========================================

//                    Set.main

//=========================================

//

Set.main = function () {

  Set();

};

Set.main();

// EOF

"Set.jsx"

// EOF

This topic has been closed for replies.

14 replies

Inspiring
August 23, 2018

here is what i wana do, i want to record this feature, Go to end of work area, now it does record, but as a script it does not work

Inspiring
August 23, 2018

if you want to test the script, then just open an image in PS, then duplicate the layer, show timeline, then run the script, t should move the marker to the end of timeline

Inspiring
August 23, 2018

also, this is not a video, just a normal jpeg, if you run the set action on the layer, then the marker moves to the end of the timeline, but it has to be done after you create a video timeline

JJMack
Community Expert
Community Expert
August 23, 2018

Is you video timeline frame rate 30fps or not?  Does you document have the right condition or is the correct type? Are you getting errors like command not available etc. What is happening?

JJMack