Activating listers/tabs from a script

I have a DOpus.Listers object, and I know the index of the lister I'm looking for, but how do I activate that lister window?

How do I activate a tab from a DOpus.listers.lister.tabs object?

Create a Command object, set its source tab to the lister's source tab, then have it run
Set LISTERCMD=ToFront

Similar but with Go TABSELECT=n where n is the tab index (same order as in the tabs collection, starting from zero).

1 Like

It worked!
And TABSELECT can take a tab object as an argument!
Thanks a lot!

1 Like

Ah, of course. Even easier. I forgot it could do that.

Go TOFRONT doesn't seem to work with TABSELECT.
Maybe it's not meant to?

If it doesn't work as a single command, just run two separate commands.

Although if the aim is to find and display the tab for a particular folder, there's probably an easier way to do all of it.

Okay it selects the target tab, but it doesn't actually make it the source/active tab.

I'm thinking of checking
DOpus.Listers.lister(n).tabs(x).source

And if it's not the source then run
Command.RunCommand('Set SOURCE=toggle');

But is there a more direct way to do it? i.e. some command that says "make x tab the source tab".?

SetSourceTab

That only sets the source tab for the Command object.

What else do you want it to do?

Set the source tab. (not just source tab of the Command object)

You mean for the File Display? Try running

Set FOCUS=source

Doesn't work.
The way the help file is written I think it means source tab and the Command object's source tab are two different things.

In the description of of SetToSource it says "Sets the command's source to the specified tab." If they were the same thing, I'd expect it to say "Sets the source tab to the specified tab".

The command object and the file display will get out of sync when the script is running. Try additionally running

Set SOURCE=focus
1 Like

That did it.
Thank you!

Well I could have sworn this was working last night, but now it's not.
If the source, or last active file display in a lister is on the opposite side than the target tab when the script runs then the target tab ends up being the destination.

Use cmd.SetSource (or cmd.SetSourceTab) and cmd.SetDest (or cmd.SetDestTab) to designate which folders (or tabs) the command goes to and from.

If you're using one (source), you probably need to be using both (source & dest), unless the command doesn't involve a destination.