Saved Lister Layout bring Forward if already opened

Hi,

I have a saved layout of tabs etc in a lister layout I saved. I created a shortcut for the desktop through DOPUS that will let me launch my saved lister layout. My question is, is there a way to enable if the "saved lister" is already opened (just perhaps minimized or behind another window) that it would bring the "saved lister" forward to the screen or mouse cursor?

If you want to bring any existing Opus window to the front if there is one, and open the layout otherwise, that's probably quite simple.

If you want to look for window(s) which were opened from that particular layout, ignoring any which weren't, that is also possible but a bit more complicated. We can help though.

Which one do you want to do?

Hi Leo,

It would be the latter you describe, or option "B":

If you want to look for window(s) which were opened from that particular layout, ignoring any which weren't, that is also possible but a bit more complicated. We can help though.

Here's a .dcf file you can save to your desktop and double-click to switch-to or open a layout, based on whether any existing window(s) from it are open.

Edit the LAYOUT NAME HERE near the top to change which layout it opens. (You can edit it in a text editor. Or import it to a toolbar, edit the button, then save it again. Using a text editor is probably quickest.)

Show Layout.dcf (1.5 KB)

Here's the script inside the .dcf file for reference:

function OnClick(clickData)
{
	var layoutName = "LAYOUT NAME HERE";

	var cmd = DOpus.Create.Command();
	var foundAny = false;

	for(var eListers = new Enumerator(DOpus.listers); !eListers.atEnd(); eListers.moveNext())
	{
		var lister = eListers.item();
		var layout = lister.layout;

		if (layout.toUpperCase() == layoutName.toUpperCase())
		{
			foundAny = true;
			cmd.SetSourceTab(lister.activetab);
			cmd.RunCommand("Set LISTERCMD=tofront");
		}
	}

	if (!foundAny)
	{
		cmd.RunCommand("Prefs LAYOUT=\"" + layoutName + "\"");
	}
}

Thanks Leo. This is perfect!

Exactly what I was looking for. Thanks a bunch! <3

1 Like