Noob here,Trouble with pinpointing element (People&Places)

Like title says im having problems with enumerables?
i apologize as im a complete noob with c#

ill try to make this quick as possible
what i want to do is get a specific element/bookmark(lets say b1) from the People&Places window, i just need to be able to right click it, i have most of the codes ready its the only part i have problems.

However all i know to use are the LastOrDefault() and FirstOrDefault(), i dont know how to pick out a specific one from multiple branches. cant i just select the specific element # since the list order doesnt change anyways. I can do the listSurroundingsButton thingy but its kinda limited to within the solar system?
setting destination to bookmarks beyond the system cant be done there. The whole script is a simple hauler script btw, Takes every ore from one station to another(with the autopilot 0km)

Here is its specific path

Sanderling?.MemoryMeasurementParsed?.Value?.WindowPeopleAndPlaces?.FirstOrDefault()?.LabelText?.//What to place here?//

TIA, and sorry again.

EDIT:Nevermiiiinnnnddd i think

MemoryMeasurementParsed?.Value?.WindowPeopleAndPlaces?.FirstOrDefault()?.ListView?.EntryFirstMatchingRegexPattern(somethingsomething, RegexOptions.IgnoreCase)

will do the job, i think i was loloking at the wrong values.

EDIT:still cant get it to work T_T

You can, by using the method ElementAtOrDefault.
In that screenshot, I see you have selected element 21. You can get this element with the code .ElementAtOrDefault(21) in your script. You can use it in the same places where you could use .LastOrDefault() and .FirstOrDefault().

1 Like