Find tab with specific mtp path

I am enumerating directories of a mtp device. Then i am opening a new tab for the paths that I get from the enumeration. I then want to have a reference to that tab. So I enumerate the tabs and try to compare the tab path with the path from the enumeration/thrown in the GO command.

My problem is that the path used for the GO argument differs from the tab that was opened with this command and the comparison fails.

GO mtp://Z 6_2 (2)/?s10001?|Wechselmedien\DCIM/?o11198000?|102NZ6_2
opens a tab that has the path
mtp://Z 6_2 (2)/?s10001?|Wechselmedien/?o11004000?|DCIM/?o11198000?|102NZ6_2

I see that those paths are similar but I dont know how to check if the folder they are referencing is the same. I found this but I dont know how this could solve my problem.

function OpenSourceTab(pathToOpen, clickData)
	var cmd = clickData.func.command;
	var currentLister = clickData.func.sourceTab.lister;//DOpus.listers.lastactive
	cmd.RunCommand("GO \"" + pathToOpen + "\" NEWTAB=findexisting");

	for (var eTabs = new Enumerator(currentLister.tabs); !eTabs.atEnd(); eTabs.moveNext())
		var tab = eTabs.item();
		if(tab.path == pathToOpen) //here is my problem
			return tab;
	return null;

I am going with this function since there might be several folders later for the same device but different folders on this device.

Thanks in advance.

Command.results will give you the tab(s) opened from the command you just ran. That'll give you what you need directly without having to search for the tab by path.

1 Like