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

Creating a Sequence by Linking to Preset -- Filepath issue

Explorer ,
May 11, 2017 May 11, 2017

Copy link to clipboard

Copied

I am trying to create a sequence from a variety of presets. These presets work well when I am directly linking to the .sqpreset in a drive on my computer, however I would like to package these links within the panel directory so they can work anywhere.

When I run the following code it works great if running directly from Extendscript, but when I load it in a panel I have no luck.

           var scriptLocation = File($.fileName).fsName

           sliceOne = scriptLocation.lastIndexOf("/");

           var filePlacement = scriptLocation.slice(0, sliceOne+1)

             var preset1360 = filePlacement + "Presets/1360x768_30FPS.sqpreset";

             var preset720 = filePlacement + "Presets/1280x720_30FPS.sqpreset";

             var preset1080 = filePlacement + "Presets/1920x1080_30FPS.sqpreset";

app.enableQE();

          

        if (seqPreset == "1080"){

                desiredPreset = preset1080

            }

        if (seqPreset == "720"){

                desiredPreset = preset720

            }

        if (seqPreset == "1360"){

                desiredPreset = preset1360

            }

            

  if (seqPreset == "1080" || seqPreset == "720" || seqPreset == "1360" ) {

                qe.project.newSequence(seqName, desiredPreset);

  }else{

                   alert("Please try again." + "\r" + "\r" + "Enter a valid resolution")

            }

       

        }

Any help would be great. Making sequences is essential but if I can't package the preset, that'd be a shame.

TOPICS
SDK

Views

1.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

correct answers 1 Correct answer

Adobe Employee , May 12, 2017 May 12, 2017

You see how PProPanel does this, right?

If you look in /PProPanel/index.html, you'll see me use CEP calls to get path to the panel's own /payloads directory, make it platform-agnostic, then build up the ExtendScript command string to be sent, via evalScript:

https://github.com/Adobe-CEP/Samples/blob/master/PProPanel/index.html#L96

Then, in /PProPanel/jsx/Premiere.jsx, is where the sequence gets created, based on the preset passed in, from [above]:

https://github.com/Adobe-CEP/Samples/blob/master/PProPanel/jsx/Premiere.jsx#L376

Votes

Translate

Translate
Engaged ,
May 12, 2017 May 12, 2017

Copy link to clipboard

Copied

Hi,

I assume your path for the preset is wrong, have you checked these? If you run from a ./jsx/YourScript.jsx sub-folder when using the panel, you'd have to go with $.fileName.parent.parent.fsName, this will also save you the next 2 lines. I also recommend using the getSep() function from the PProPanel sample to get the correct separators for each OS.

[I would also really compact the code, save branches where not necessary a define variables only in the scope they're needed. But this might just be an excerpt from your entire script and you need the vars further down the script too.]

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
Adobe Employee ,
May 12, 2017 May 12, 2017

Copy link to clipboard

Copied

You see how PProPanel does this, right?

If you look in /PProPanel/index.html, you'll see me use CEP calls to get path to the panel's own /payloads directory, make it platform-agnostic, then build up the ExtendScript command string to be sent, via evalScript:

https://github.com/Adobe-CEP/Samples/blob/master/PProPanel/index.html#L96

Then, in /PProPanel/jsx/Premiere.jsx, is where the sequence gets created, based on the preset passed in, from [above]:

https://github.com/Adobe-CEP/Samples/blob/master/PProPanel/jsx/Premiere.jsx#L376

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
Engaged ,
May 12, 2017 May 12, 2017

Copy link to clipboard

Copied

Well Bruce, we don't know how the OP is going about it, right?

If we read carefully, the post suggests the OP is doing the path retrieval in the jsx -- if this is the case and they decide to stick with it, your approach as shown in the PProPanel won't get them where they want the way they want. This will only work if they c&p your code as a lazy man's solution. If the OP had done proper debugging (which I did to reproduce the issue) the solution would have been quite straightforward...

This lends itself to a good question:

In your (read: Adobe's) perspective, should (somweone writing) a script try to perform as many transactions as possible in JS (outside the extendscript's JSX), if so, for what reasons? Or doesn't it even matter?

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
Adobe Employee ,
May 12, 2017 May 12, 2017

Copy link to clipboard

Copied

JavaScript? ExtendScript? Doesn't matter.

Many panel partners have web UI's already, so continuing to do everything in JavaScript makes sense.

ExtendScript coders who have working File handling code, should feel no need to move file handling to JavaScript.

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
Engaged ,
May 12, 2017 May 12, 2017

Copy link to clipboard

Copied

LATEST

Okay, it's just that it's not obvious what might be considered legacy and there not be a favourable approach. If developers can continue using both ways without fearing they need to re-write everything because the APIs has been deprecated or dropped, that's fine.

It's already enough work to support multiple generations of the host application, but some times you just can't make stuff work everywhere, can you?

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