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.
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?)
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?
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.
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.
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.