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

JSX not running synchronously in CEP 9

Contributor ,
Jul 29, 2020 Jul 29, 2020

Copy link to clipboard

Copied

From what I've read on a mac JSX should be executed syncrhonously.  Meaning that each function should run and the next should wait for the first to finish before it runs.

I have the following methods:

placementClick = 0;
setIndividualTemplate(xi, placementClick, 2);
placementClick++;
setIndividualTemplate(xi, placementClick, 3);

setIndividualTemplate opens a file and then it places it into another document.  It does a few things.

I need for the first setIndividualTemplate to complete and then for the next one to fire up after.  However this does not seem to be the case.

To test this I put an alert in setIndividualTemplate

alert('which: ' + placementClick);

the alert fires up 'which 0'

then 'which 1'

then it actually executes the commands in each method.  How can I make this wait for one to finish before the other one starts?  From my understanding I can't use promises.

TOPICS
Scripting

Views

260

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
Community Expert ,
Jul 29, 2020 Jul 29, 2020

Copy link to clipboard

Copied

Hi,

Could you please share the code the function named 

setIndividualTemplate

By seeing the code, it will be easy to figure it out which command is taking the time to execute.

Best regards

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 ,
Jul 29, 2020 Jul 29, 2020

Copy link to clipboard

Copied

Hi thanks for responding. Does it matter what it does?
It opens and copies some info from the file. The point isn't how long it
takes since it's synchronous? Shouldn't it wait for the entire method to
finish before the other one fires up?
That's what I mean by does it matter. Whether it takes one second or two
minutes it should wait 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
Community Expert ,
Jul 30, 2020 Jul 30, 2020

Copy link to clipboard

Copied

Yes that's correct what you are saying. It should work syncrhonously, But getting a code will help to debug and help you out and also we can confirm whethere we are also running into same problem or not. 

Best regards

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 ,
Aug 03, 2020 Aug 03, 2020

Copy link to clipboard

Copied

LATEST

After digging into this some more.  It appears as if it doesn't run synchronously like the alerts come up back to back before the file opens but I think it does run synchronously.

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