How to do a progress bar that not decrease the execution time of my hybrid plugin

New Here ,
May 12, 2022 May 12, 2022

Copy link to clipboard

Copied

Hi Everyone,

I've developed a way to create my flyers and catalogs thanks to javascript, but now the pages of my catalogs are a lot for javascript, so I've decided to create an hybrid plugin and finally i've decreased the execution time, but there is a problem because i saw that when i use my plugin with a progress bar (developed in javascript) the time triples, because indesign automatically make me see the rendering of all page.

(the progress bar has been programmed in javascript and the plugin make the big work, like : load and read xml, make pages, apply master pages and more)

 

So my question is "Exists a way to hold the rendering only of the progress bar and not of the rest?"

I thank in advance whoever will answer the question.

 

- stefano

TOPICS
SDK

Views

222

Likes

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 Professional ,
May 12, 2022 May 12, 2022

Copy link to clipboard

Copied

Hi @Stefano5C37,

If you are using the C++ SDK for doing the heavy lifting then why use JS just for the progessbar or other trivial things. I would suggest moving all in to the C++. Talking sepcifically about progress bars, they are provided natively by the C++ SDK as well, see TaskProgressBar and RangeProgressBar in the SDK.

-Manan

Likes

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
New Here ,
May 12, 2022 May 12, 2022

Copy link to clipboard

Copied

First of all, thank you for the quick answer, anyway I’ve decided to keep the bar with Javascript because it is inside a panel with checkbox image and other elements, being new in world of plugin with C++, I don’t understand how to replicate the same panel in C++, so the fastest way to recreate the panel is to call that in javascript.

I would love to recreate it in C++, but i don't know how to make panel with text, checkbox, checklist, buttons and images.

- Stefano

Likes

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 Professional ,
May 12, 2022 May 12, 2022

Copy link to clipboard

Copied

Hi Stefano,

I am not suggesting recreating your whole panel using C++. What I suggest is that if progress bar is the issue here and without it your JS and C++ combination is working fine then you could consider replacing the JS progress bar with a C++ progress bar. It's quite easy and needs no more than creating an object of the class with required params, updating the params to move the progess bar. Also, did you find merit in opening the document without a window, try it that might help.

-Manan

Likes

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
New Here ,
May 12, 2022 May 12, 2022

Copy link to clipboard

Copied

Oh sorry Manan, I aswered about this before but the answer has not been loaded, sorry for making you repeat the same thing 2 times, anyway I also tried to implement a progress bar also in C++, but the execution times don't change.

I noticed that doing it in C++ or javascript doesn't change the time execution, because when I use a progress bar automatically InDesign show me the rendering of the pages.

The problem is that I'm obliged to show the status of the impagination, so I'm searching a way to block the mechanism of InDesign that show me the page, I want to keep the graphical at minimum (to be as fast as possible) during the impagination and see only the status of that through a progress bar.

I've attached 2 image the first rappresent the paging when i don't use a progress bar, the second rapresent the paging using a progress bar in js or C++, but what I would like is the mix of both, because i want a progress bar, but i don't want to see the render of page.

- Stefano

Likes

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 Professional ,
May 12, 2022 May 12, 2022

Copy link to clipboard

Copied

Regarding stopping the rendering of the page. Try opening the document without a visible window, that way since the document is not shown at all, so InDesign would not have to do any tasks related to the rendering.

-Manan

Likes

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
New Here ,
May 13, 2022 May 13, 2022

Copy link to clipboard

Copied

If you opened the document like that, the progress bar would also disappear, or not?

- Stefano

 

Likes

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 Professional ,
May 16, 2022 May 16, 2022

Copy link to clipboard

Copied

LATEST

No it should not. We are just instructing that we don't want a UI window to display the document. Regarding the progress bar it's just an object on stack that displays the progress based on the value you set for the progress. So this should work in my opinion, you should give it a shot and see the results.

Look in the method you use to open the document it will have an argument that specifies whether to open a window for the document or not. Alternatively you could open the document without window using JS and then tweak your code to work on the frontmost document, that way you will be able to test the workflow quickly and if it does work then you can search for API in the C++ sdk.

In JS the details of the method for opening the document can be seen at the following link.

https://www.indesignjs.de/extendscriptAPI/indesign-latest/#Application.html#d1e42253__d1e47649

-Manan

Likes

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
LEGEND ,
May 13, 2022 May 13, 2022

Copy link to clipboard

Copied

Some thoughts. I work in Acrobat plugins and have found progress bars cause a slow down. Acrobat does not render the page but it takes time to render a progress bar. These may not apply to InDesign.

1. if you tell InDesign to update the progress bar yourself, do this less often. Check the clock and only do it after a time has passed for the last update. 
2. If InDesign supports a custom progress bar callback, use this instead. Two possibilites

(a) call an InDesign progress bar, but less often

(b) implement your own progress bar in platform UI (Mac or Windows directly) without updating InDesign at all. 
3. Use a platform UI progress bar and hide the InDesign window. Be sure to set an exception trap so it is always shown again, even on failure. 

Likes

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
New Here ,
May 13, 2022 May 13, 2022

Copy link to clipboard

Copied

Hi,

first of all, thank you and for the excellent ideas anyway, regards proposal 1 and 2.a, they are interesting but I had already implemented and in fact I have reduced the execution time but I have not solved the problem anyway, while as regards proposal 2.b and 3 are very very interesting but I have no idea of how to implement it(if you know how to do it you could direct me to the material to study, I would be grateful).

If I understand correctly you intend to use a progress bar of the Mac and not an internal one of InDesign, and I think it can absolutely work, but first i want to search a method internally of InDesign (like blocking the rendering of pages) then if I can't find it or if it not possible, I will surely do as you said.

Thank you very much for the proposals made.

- Stefano

Likes

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 Professional ,
May 13, 2022 May 13, 2022

Copy link to clipboard

Copied

Hi Stefano,

hm… I think you could increase execution time by NOT SHOWING the Pages panel.

Instead, before running your main code, zoom to a spread and perhaps to a blank area on the pasteboard where nothing happens.

 

Regards,
Uwe Laubender

( ACP )

 

Likes

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