Determining/Setting "Active" Lister

In a script I can determine what listers are open. Is there a way of establishing and setting which one is active/foreground? I thought the following code bound to a system wide hotkey code would allow me to cycle through multiple open listers but it simply toggles between the first two open listers when three or more listers are open. I had assumed that listers(0) was the active lister and that Go FINDTITLE "Some Existing Lister Title" would set/change listers(0) when executed, but it doesn't.

[code]@language vbscript
Option Explicit

Function OnClick(ByRef ClickData)
Dim cdf, cmd, s
Set cdf = ClickData.Func
Set cmd = cdf.Command

cmd.deselect = False
If DOpus.listers.count = 1 Then
s = DOpus.listers(0).title
Else
s = DOpus.listers(1).title
End If
s = "Go FINDTITLE " & """" & s & """"
cmd.runcommand s
End Function[/code]
Regards, AB

I'd also be interested to know. I was searching for a way to get the active or last used lister recently as well.
Put different, how to get the lister/source affected by something run by dopusrt.exe e.g.

If you're running things via dopusrt.exe or system-wide hotkeys then that implies there may not be an active window to find.

If there was always an active window, you would not need to run the things via a global hotkey or dopusrt.exe.

So I'm not sure I understand the question, unless you mean the last-active window which may not currently be active anymore.

Hehe, I think I understand the irritation. o)

Think of:

dopusrt.exe /acmd select myfolder

The select command run by dopusrt.exe will affect the source display in the last active lister.
That source display/lister is to be found by script (for me at least, don't know if aussie's topic is exactly that, is it?)

Thx! o)

How are you running the script?

I really don't wanna hijack this thread.. o)

I tried to get the last active lister/source display from within a script-command invoked by dopusrt.

The ClickData gives you the active lister (if any) for the command if you are running it that way.

Yes, that's my situation. When I have multiple listers in play I'd like to establish from a script that is not bound to a specific lister (e.g. a script that is executed from a system wide hotkey) which of these listers is either the foreground window or is the lister that was most recently the foreground window. That would give me a starting point to cycle through them.

Perhaps a boolean foreground property and a boolean lasttouched property for the Lister object?

Regards, AB

From further testing it seems that listers(0) is always the last referenced lister. The way that listers(1), listers(2), listers(3), etc. are reassigned when the foreground lister changes is not yet clear to me but I'll run more tests.

Regards, AB

This code to cycle through listers seems to work from a system wide hotkey. The logic is now to jump from current lister to last lister.

[code]@language vbscript
Option Explicit

Function OnClick(ByRef ClickData)
Dim cdf, cmd, n, s
Set cdf = ClickData.Func
Set cmd = cdf.Command

cmd.deselect = False
n = DOpus.listers.count
If n = 1 Then
s = DOpus.listers(0).title
Else
s = DOpus.listers(n - 1).title
End If
s = "Go FINDTITLE " & """" & s & """"
cmd.runcommand s
End Function[/code]
Regards, AB

Ideally, if there is no Opus lister in the foreground window I would like to bring the most recently touched lister to the foreground and if a lister is already in the foreground, cycle to the next lister. My earlier suggestion of a boolean foreground property for the Lister object would provide the means to do this.

Regards, AB

The 11.8.1 beta we just put out has some new scripting things for this, in case there are cases where you need something other than the ClickData's idea of the active lister, or need it in the script context that don't have an active lister at all.

Many thanks for the prompt additions. I have already tweaked my code. Very nice.

Regards, AB

I also want to thank you, so.. Thank you! o)