在 FLAUI 中,试图获取对以某些字母开头或包含某些字母的子元素的引用。示例以“DOC”开头或包含“DOC”我想要做的是我正在打开一些办公文件,如 doc、xls、ppt。并希望在他打开屏幕时附加文件。
foreach (var file in listOfFiles)
{
if (file.Name.Contains("DOC") || file.Name.Contains("PPT") || file.Name.Contains("XLS") || file.Name.Contains("TXT"))
{
file.AsButton().Invoke();
var window = new UIA3Automation();
desktopWindow = window.GetDesktop();
desktopWindow = WaitForElement(() => desktopWindow.FindFirstChild(cr => cr.ByName("// Here want to put name that start with ... or contains ...")));
var app = FlaUI.Core.Application.Attach(desktopWindow.Properties.ProcessId);
var application = app.GetMainWindow(new UIA3Automation());
CloseingProcess(application.Name);