Overview active tab


#1

Hello,
I like to know how i can find what tab is active in overview and extract his name, so in anomaly i could change the tab.
what i know is: the active tab has LabelColorOpacityMilli = 1500 ( the rest have 750).
The name is under label in measurements…
the whole idea is: I extract the name of active tab, compare with another name and change the tab in overview. I have to do that couple times.
I’m totally noob and I don’t know to do that, can you help me?
Thank you


#2

This reminds me of functionality found in the demo mining script included with the Sanderling app:

Can you use that implementation to get the active tab?


#4

yes I saw, but is not what i want. anyway, i will make this way


#5

hi, am working on it as well.
issue with this implementation in abot is that name is completely ignored and its extracted first from sorted field.
so basically u can use only first or last tab.

simple regex on the label is not working for some reason asit is keep saying something like regex is not defined in tab[]?

interesting is that all of other overview informations can be regexped just fine, but not preset tab.


#6
	Tab OverviewTabActive =
	memoryMeasurement.WindowOverview?.FirstOrDefault()?.PresetTab
	?.OrderByDescending(tab => tab?.LabelColorOpacityMilli ?? 1500)
	?.FirstOrDefault();

	var combatTab = memoryMeasurement.WindowOverview?.FirstOrDefault()?.PresetTab
	?.OrderByDescending(tab => tab?.Label.Text.RegexMatchSuccessIgnoreCase("combat"))
	?.FirstOrDefault();

	var salvageTab = memoryMeasurement.WindowOverview?.FirstOrDefault()?.PresetTab
	?.OrderByDescending(tab => tab?.Label.Text.RegexMatchSuccessIgnoreCase("misc"))
	?.FirstOrDefault();


later:
			if (combatTab != OverviewTabActive) 
			yield return new BotTask { Effects = new[] { combatTab.MouseClick(MouseButtonIdEnum.Left) } };
and is working, I change at any time and when i need; ( you dont use the presets from inside on same tab, you just simply clik on tab

#7

rhis implementation unfortunately ignores name, its beeing selected only as FIRST from DESC sorted list

playing with it right now :slight_smile:


#8

you wanna say he doesnt change the active tab for you? because in sanderling at preset tab at 0 you have the text with the name of first tab at 1 the second tab etc etc.
If you want to change in the same tab the preset, you have in sanderling inside miner script ( the ones default who come with the exe) the way how you can change the preset. ( and is working). basicaly, on active tab he click right, change the preset with the one desired.


#9

Not exactly :wink: I’m saying that it change to proper tab, but just because I have it as last one.
I’m playing with following code. And all I can say is, whatever name I’ll put to “CorrectOverviewTabName” bot will ALLWAYS select last tab from all of them, no matter what name it is.

And it’s logical if you see the code.

				// check if bot works with correct overview
				var OverviewTabActive         =	memoryMeasurement?.WindowOverview?.FirstOrDefault()?.PresetTab?.OrderByDescending(tab => tab?.LabelColorOpacityMilli ?? 1500)?.FirstOrDefault();
				var BotOverviewTab            = memoryMeasurement?.WindowOverview?.FirstOrDefault()?.PresetTab?.OrderBy(tab => tab?.Label.Text.RegexMatchSuccessIgnoreCase(Variables.CorrectOverviewTabName)).LastOrDefault();

				if (BotOverviewTab != OverviewTabActive)
				{
					yield return new BotTask
					{
						Effects = new[]
						{
							BotOverviewTab?.MouseClick(MouseButtonIdEnum.Left),
						}
					};
				}

I wanted to do something like this:

var BotOverviewTab            = memoryMeasurement?.WindowOverview?.FirstOrDefault()?.PresetTab?.Where(entry => entry?.Label?.RegexMatchSuccessIgnoreCase(Variables.CorrectOverviewTabName) ?? false).FirstOrDefault();

but unfortunately it’s keep saying “Tab[]” does not have defined Where … or smthing like that


#10

silly me … this code is working :wink:

var OverviewTabBot = memoryMeasurement?.WindowOverview?.FirstOrDefault()?.PresetTab?.Where(tab => tab?.Label.Text.RegexMatchSuccess(Variables.CorrectOverviewTabName) ?? false).FirstOrDefault();

#11

:)) ok then
only trick is how you define the variables.correctoverviewtabname. I supose is a list of items, or array, whatever