Industry Index Scrape


#1

Hi,

I am interested in finding/building a script to scrape a region for the Industry Index in eaxh system (ADM), down to the specific percentage value. I have not found a existing solution and am also lacking a way to start solving this. Maybe someone here can point me in the right direction (tools to use etc.)

Thank you


#2

Welcome @huihui!

In this case, you can start with taking a screenshot which contains the information the information that should be read. We can take a look at that then.
Regarding tools: paint.net is good because it makes anotating screenshots with distinct image layers easy.


#3

Thank you for the welcome @Viir
I assumed people know the ADM Industry Index and where to find it. Best would be to give the script a list with System names (if done via ingame Notepad it is a link that can be clicked) after navigating to the correct window it will look like this.
Capture1
The important part is that the mouse now needs to hover over the rightmost partially filled in rectangle. Then this pops up.Capture2
This is the important information we are after and want to record over time.


#4

on the actual version of Sanderling, we don’t have this kind of information( to move the mouse over this rectangles)
you have 2 options:
to create/extend some regions on same row with the text


to add this measurements ( with white rectangles/gray rectangles) to Sanderling

to use Sprite color and Id of texture old, if you can
rr


#5

For sure there are people around who know more about the the ADM Industry Index than I do.

This looks like the region to move the mouse to is always at a fixed location relative to the lower right corner of a window. In this case you can use the title of the window (seems to be cropped away in the image you posted) to select the correct window.

I think there is a good chance that this popup window is already contained in the memory measurement which is read by the Sanderling memory reading. We can look for it in the API explorer.

One important point regarding tools: To share screenshots and other images, imgur.com works well.


#6

Sry I did not mean to offend in any way.

Thank you for the good responses. The Problem might still be, that the important rectangle is not always in the same place. Sometimes it will be the first, sometimes the second,third… Also I never tried working with sanderlings. Can someone point me to a good point/guide to start?


#7

How can we find out where it is? How can you do that based on a screenshot?
In your screenshot, I see that a text Industry Index appears on the row you marked. Can we use that label as a reference for the vertical location of the region to move the mouse to?

There is a good guide on Sanderling by Terpla: Terpla adventures or blog-style guide for begginers

If you have a question which is not covered there, I can look up the right guide for your question.

Another good starting point is this guide: How to Automate Anything in EVE Online


#8

maybe it is best to record the readout of every rectangle and stop whenever a “%” is shown. E.g. If a System has Level 3 30% it will read “Level 1” on the first “Level 2” on the second “Level 3 30%” on the third and “Level 4” on the fourth.


#9

Sure, we can go that route.
I am setting up a Windows Instance for the EVE Online client here to test this.


#10

I found this script to implement this scraping process:

/*
https://forum.botengine.org/t/industry-index-scrape/2313/8

record the readout of every rectangle and stop whenever a “%” is shown.
E.g. If a System has Level 3 30% it will read “Level 1” on the first “Level 2” on the second “Level 3 30%” on the third and “Level 4” on the fourth.
*/

int rowHeight =20;

int rowCount = 7;

bool skipMouseMove = false;

int nextRowIndex = 0;

while(true)
{
	if(skipMouseMove)
	{
		Host.Log("Skip mouse move.");
		goto logTooltip;
	}

	Host.Delay(3000);
	Sanderling.InvalidateMeasurement();

	var window = Sanderling?.MemoryMeasurementParsed?.Value?.WindowOther?.FirstOrDefault();

	if(window == null)
	{
		Host.Log("No window found in the WindowOther collection.");
		continue;
	}

	Host.Log("The window has the caption '" + window.Caption + "'");

	var windowRegionRight = window.Region.Max0;
	var windowRegionBottom = window.Region.Max1;

	Host.Log("Window region right=" + windowRegionRight + ", bottom=" + windowRegionBottom);

	var nextRowVerticalCenter = windowRegionBottom - rowHeight * (nextRowIndex + 1); 

	var regionToMoveMouseTo = new RectInt(windowRegionRight - 50, nextRowVerticalCenter - 4, windowRegionRight - 30, nextRowVerticalCenter+ 4);

	Host.Log("nextRowIndex is " + nextRowIndex + ", moving the mouse to " + regionToMoveMouseTo);

	Sanderling.MotionExecute(MouseMoveWithRegionSubstituted(window, regionToMoveMouseTo));
	//	Sanderling.MotionExecute(window.WithRegion(regionToMoveMouseTo).MouseMove());

	nextRowIndex = (nextRowIndex + 1) % rowCount; 

	//	After moving the mouse, give EVE Online client some time to open the tooltip.
	Host.Delay(1111);

logTooltip:

	Sanderling.InvalidateMeasurement();
	var tooltip = Sanderling?.MemoryMeasurementParsed?.Value?.Tooltip;
	var allTooltipUIElements = tooltip?.EnumerateReferencedUIElementTransitive().ToList();
	Host.Log("allTooltipUIElements : " + String.Join(",", (IEnumerable<IUIElement>)allTooltipUIElements ?? new IUIElement[0]));
	
	var allTooltipTexts = allTooltipUIElements?.OfType<UIElementText>().Select(textElement => textElement.Text).ToList();
	Host.Log("allTooltipTexts : " + String.Join(", ", (IEnumerable<string>)allTooltipTexts ?? new string[0]));
}

//	Based on the example from https://forum.botengine.org/t/click-on-specific-smaller-region-maxx-10/194/4
static MotionParam MouseMoveWithRegionSubstituted(
	IUIElement destination,
	RectInt region) =>
	new MotionParam
	{
		MouseListWaypoint = new[] { new MotionParamMouseRegion { UIElement = destination, RegionReplacementAbsolute = region, } },
	};

You can run this script with the newest version of the Sanderling App from https://github.com/Arcitectus/Sanderling/releases/download/untagged-992892b93453bdba1596/2019-03-30.Sanderling.exe

As you will see in the log, this script also outputs the text in the tooltip.


#11

Sorry I was away the last weeks. I will habe a look at this first thing tomorrow. Ty for your help.