public API_GuiAutomation setGuiAutomation() { "Mapping GuiAutomation Objects".info(); //var localProcess = Processes.getCurrentProcess(); //guiAutomation = new API_GuiAutomation(localProcess); var ieProcess = Processes.getProcesses() .Where((process) => process.MainWindowTitle.contains("SI Question Pool")) .First(); guiAutomation = new API_GuiAutomation(ieProcess); if (guiAutomation.notNull()) { "got GuiAutomation Object for local Process".info(); } guiAutomationWindow = guiAutomation.windows()[0]; if (guiAutomationWindow.notNull()) { "got GuiAutomation Window Object for local Process".info(); } else { "failed to get GuiAutomation Window Object for local Process".error(); } //setGuiAutomationExamGroupBox(); //if (guiAutomation.isNull() || guiAutomationWindow.isNull() || guiAutomationExamGroupBox.isNull()); // "in setGuiAutomation, one of the expected UIAutomation objects could not be calculated".error(); return(guiAutomation); }
public static Window window(this API_GuiAutomation guiAutomation, string windowName) { if (guiAutomation.notNull()) { foreach (var window in guiAutomation.windows()) { if (window.Name == windowName) { return(window); } } } return(null); }
public static List <Window> windows(this API_GuiAutomation guiAutomation) { try { if (guiAutomation.notNull() && guiAutomation.Application.notNull()) { return(guiAutomation.Application.GetWindows()); } } catch (Exception ex) { ex.log(); } return(new List <Window>()); // do a soft landing }