Open pictures in paced sequence

Gloops

Well-known member
Joined
Jun 30, 2022
Messages
128
Programming Experience
10+
Hello everybody,

When you receive a mail with attachments in Thunderbird, in the contextual menu of the list of attachments you have an "Open all" command (I translate it, it is the first command in the contextual menu), that allows you to open all files with the application that is attached to them in the file types records.

On my machine, that has 64 GB of RAM and a quick processor, that runs pretty good. It opens all pictures in the temporary folder, the user can see them open and count them, and then, with one of the opened windows, IrfanView can browse between them.

But on a slower machine, IrfanView takes a little more time to open, and so far I saw, nothing is planed in Thunderbird to temporize between two calls. So, you see pictures open, but the time one is opened, Thunderbird has called two or three others, so the user does not see all the windows opened. So he cannot count them, and he does not know when it is finished.

I intend to write a program that will receive the paths to the pictures, memorize them, and once a certain time (maybe one second) has elapsed without a new picture being "opened" by Thunderbird, then opens the pictures with the attached application, but this time with a temporization of one second between two calls (if the need appears it will be simple to increase this delay).

The difficulty is that a new occurrence will be called for each picture, and then one unique occurrence must open them.

I presume one good idea can be to open a mutex to ensure having a "unique" instance, and that instance can contain a generic list to contain the paths. After that there is no drawback for the other instances to close themselves.

I saw an application use a mutex, I presume that by mimicking (is the spelling correct?) it I should be able to complete it.

There is another possibility, to call IrfanView immediately, and simply evaluate the time elapsed, and once it increases, display a message telling how many pictures were opened.


Is there any better idea, any points to pay attention to ?

I did not really pay attention to the fact that the path is given once IrfanView opens the file in the temporary folder. As it will not be the case for it will be called by the unique occurrence only once the application has been called for all pictures, maybe I have to copy the files to the temporary folder myself. I then only have a vague idea of how to do.

Then, once this is done, maybe I only need to open one occurrence of IrfanView, with the first picture.
 
Top Bottom