Button script, pass source and target paths to external application

I need some help with a simple button script that passes all the tabpaths of the source pane/lister to an .exe like this:
All tab paths from the source pane/lister: c:\app.exe "path1" "path2" ,...etc...
Paths enclosed in double quotes and seperated by one space

I can do it with the current source folder but I want to pass all the tab paths (source lister , target lister and both listers).
An example for the source lister tabs, target lister tabs and both listers tabs would be really appreciated.

With "source lister tabs" I mean: all the tab paths which are open in the current active lister (pane).
With "target lister tabs" I mean: all the tab paths which are open in the target lister (pane).
With "both listers" I mean: the "source lister tabs" and "target lister tabs"

EDIT:
Sorry, I forgot to ask: If the above is possible, is it then also possible to specifically indicate left and right lister (in stead of source and target)?

EDIT2:
Forgot to mention that I searched to forum and tried to modify sample scripts but I could not get to work.

DOpus.Output("These tabs are open:");
DOpus.Output("");
for (var eListers = new Enumerator(DOpus.listers); !eListers.atEnd(); eListers.moveNext())
{
   for (var eTabs = new Enumerator(eListers.item().tabs); !eTabs.atEnd(); eTabs.moveNext())
   {
      DOpus.Output("  " + eTabs.item().path);
   }
}

and

	DOpus.Output("Folder tabs open across all windows:");
	for(var eListers = new Enumerator(DOpus.listers); !eListers.atEnd(); eListers.moveNext())
	{
		for (var eTabs = new Enumerator(eListers.item().tabs); !eTabs.atEnd(); eTabs.moveNext())
		{
			DOpus.Output("  " + eTabs.item().path);
		}
	}
function OnClick(clickData)
{
	var fsu = DOpus.FSUtil;
	var lister = clickData.func.sourcetab.lister;

	// n.b. You can just use lister.tabs to get a collection of all of them.
	// But if you want to do something different (unspecified) with the left and right
	// ones then you can access the left and right lists separately, like this:
	var tabsLeft = lister.tabsleft;
	var tabsRight = lister.tabsright;

	var cmdLine = '"C:\\app.exe"';

	for (var e = new Enumerator(tabsLeft); !e.atEnd(); e.moveNext())
	{
		resPath = fsu.Resolve(e.item().path);
		cmdLine = cmdLine += ' "' + resPath + '"';
	}

	for (var e = new Enumerator(tabsRight); !e.atEnd(); e.moveNext())
	{
		resPath = fsu.Resolve(e.item().path);
		cmdLine = cmdLine += ' "' + resPath + '"';
	}

	var cmd = clickData.func.command;
	cmd.deselect = false; // Prevent automatic deselection.
	cmd.ClearFiles(); // Don't want to run commands on selected files.

//	cmd.RunCommand(cmdLine);
	DOpus.Output(cmdLine);
}

Should look similar to this if you're creating a toolbar button:

1 Like

THANK YOU!!!
I really appreciate this!

1 Like