Каким образом програмно получить значение поля Tag из программы Pilot-BIM? Т.к. программа написана на dotNet, её GUI “подчиняется” модели автоматизации пользовательского интерфейса Microsoft.

Соответственно, берём UISpy и ищем наше поле:

|
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 |
using namespace System; using namespace System::Windows::Automation; #include "Program.h" namespace uiAutomat { ref class CMain { static int main(array<System::String*>* args) { PropertyCondition* findWindow = gcnew PropertyCondition(AutomationElement::AutomationIdProperty, "mainPilotView"); AutomationElement* window = AutomationElement::RootElement->FindFirst(TreeScope::Children, findWindow); PropertyCondition* pcPropertiesDataGrid = gcnew PropertyCondition(AutomationElement::AutomationIdProperty, "ObjectPropertiesDataGrid"); AutomationElement* ObjectPropertiesDataGrid = window->FindFirst(TreeScope::Descendants, pcPropertiesDataGrid); ScrollPattern* scrollPattern = (ScrollPattern)ObjectPropertiesDataGrid->GetCurrentPattern(ScrollPatternIdentifiers::Pattern); scrollPattern->ScrollVertical(ScrollAmount::LargeIncrement); /* PageDown */ PropertyCondition* pcPset_ElementInformation = gcnew PropertyCondition(AutomationElement::NameProperty, "Pset_ElementInformation"); AutomationElement* Pset_ElementInformation = ObjectPropertiesDataGrid->FindFirst(TreeScope::Descendants, pcPset_ElementInformation); PropertyCondition* pcTagRow = gcnew PropertyCondition(AutomationElement::NameProperty, "Tag"); AutomationElement* AEl_Tag = Pset_ElementInformation->FindFirst(TreeScope::Descendants, pcTagRow); PropertyCondition* pcGridCell = gcnew PropertyCondition(AutomationElement::AutomationIdProperty, "AUIDPropertyValueCell"); AutomationElement* AUIDPropertyValueCell = AEl_Tag->FindFirst(TreeScope::Descendants, pcGridCell); PropertyCondition* pcText = gcnew PropertyCondition(AutomationElement::ClassNameProperty, "TextBlock"); AutomationElement* AEl_Text = AUIDPropertyValueCell->FindFirst(TreeScope::Descendants, pcText); String* TAGTAG = reinterpret_cast<String*>(AEl_Text->GetCurrentPropertyValue(AutomationElement::NameProperty)); return 0; } }; /* <-- semicolon because main() of CLR++ should be wrapped in a class like CMain */ } |
