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

[SCRIPTING] Bridge is not waiting the end of a function to start another

Enthusiast ,
Dec 09, 2024 Dec 09, 2024

Copy link to clipboard

Copied

Hello, there. Let's see if anybody can help...

I have a Bridge script that renames and move the visibleThumbnails to new folders.

Easy like this: I have 15 visibleThumbnails, then the script will creates 15 folders and move each visibleThumbnail to its own folder.

BUT...

I need another function to run over the new created folders.

This another function is being called after the loop that create the folders.

But this another function never runs unless I put an alert at its beginning.

 

Any help?

TOPICS
Scripting

Views

94

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 ,
Dec 10, 2024 Dec 10, 2024

Copy link to clipboard

Copied

@lfcorullon – Perhaps if you shared the code...

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
Enthusiast ,
Dec 10, 2024 Dec 10, 2024

Copy link to clipboard

Copied

I don't think it'll help. My scenario is very particular.

I have three functions:

 

function rotate() {

/*compare the width and height and rotate vertical image counterclockwise*/

}

function move() {

/*it creates a folder and move each thumbnail to one new folder.

if 15 thumbnails, then 15 folders will be created, numbered, to move each thumb to its folder*/

}

function rename() {

/*rename some files that are previously moved to a new folder*/

}

 

And I think this is the problem. Bridge doesn't wait the folder creation and the files to be moved to start the next function. When it starts, no folders are created 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 Expert ,
Dec 10, 2024 Dec 10, 2024

Copy link to clipboard

Copied

quote

I don't think it'll help.


By @lfcorullon

 

You have a problem with the code, however, you don't think that it will help to post the code in full. Not sure what can be done then.

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
Enthusiast ,
Dec 11, 2024 Dec 11, 2024

Copy link to clipboard

Copied

Ok. I'm sorry but I can't share the full code.

I just want to know if there is a way to make Bridge wait the completion of a process before to start a new one...

 

RUN function 1 and WAIT to the completion.
RUN function 2 and WAIT to the completion.

Then RUN function 3 and FINISH.

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 ,
Dec 11, 2024 Dec 11, 2024

Copy link to clipboard

Copied

quote

Ok. I'm sorry but I can't share the full code.

 


By @lfcorullon

 

In Photoshop one can use refresh or sleep – however, I don't script Bridge very often so offhand I'm not sure if it's supported:

 

 

app.refresh();

 

 

 

$.sleep(100);

 

 

These don't wait, they just add a time delay for something to catch up. Good luck, perhaps someone that scripts Bridge more often than I do can offer advice.

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
Enthusiast ,
Dec 12, 2024 Dec 12, 2024

Copy link to clipboard

Copied

LATEST

Thanks anyway.

I tried app.refresh, thumbnail.refresh, doc.refresh... none of them looks to really work.

The $.sleep() is an option, but it could get too long when processing lots of images.

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