Close lister if lister is open

I have made some buttons in a floating toolbar. These buttons open different locations on my HDD. I would like to be able to close the lister for the button if the lister is already open.

In other words, let's say I click on a button called pictures, a folder called pictures will be opened in the lister. Now the second time I click on the button, I want to close the lister if the pictures folder is already open in the lister.

Does anyone know how this can be achieved?

Could be done using a script.

Good starting points:

Thanks. I have read the two posts but I must admit I didn't quite understand much. I have installed the CloseAllTabs.osp as a script in Dopus but I have no clue what to do from there.

I the button I have

Go "C:\Users\user\OneDrive\Pictures"= OPENINLEFT

I am not sure if I have to add more to the button or where to go from here. :confused: