Je travaille avec WatIn et je sauvegarde les fichiers avec la boîte de dialogue saveAs, mais quand je verrouille Windows/pc ce processus est stop, j'ai besoin de lancer Invoke sur SendMessage que ce processus tournera quand mon pc sera verrouillé.Invoke to SendMessage
Existe-t-il un moyen de le faire?
de code avec pice Invoke
private static void ClickSaveAs(AutomationElement mainWindow, AutomationElementCollection dialogElements, string filename)
{
foreach (AutomationElement element in dialogElements)
{
if (element.Current.Name.Equals("Save"))
{
AutomationElementCollection dialogSubElements = element.FindAll(TreeScope.Children, Automation.ContentViewCondition);
InvokePattern clickPatternForSaveDropdown = (InvokePattern)dialogSubElements[0].GetCurrentPattern(AutomationPattern.LookupById(10000));
//I need to change this to..
clickPatternForSaveDropdown.Invoke();
//This
//start
int intWhdr = FindWindow("IEFrame", "");
int currChild = FindWindowEx(intWhdr, 0, "", "Frame Notification Bar");
currChild = 104755016;
int intRes1 = SendMessage(currChild, WM_LBUTTONDOWN, 0, 0);
System.Threading.Thread.Sleep(100);
intRes1 = SendMessage(currChild, WM_LBUTTONUP, 0, 1);
System.Threading.Thread.Sleep(200);
//end
Thread.Sleep(1500);
AutomationElementCollection dialogElementsInMainWindow = mainWindow.FindAll(TreeScope.Children, Condition.TrueCondition);
foreach (AutomationElement currentMainWindowDialogElement in dialogElementsInMainWindow)
{
if (currentMainWindowDialogElement.Current.LocalizedControlType == "menu")
{
// first array element 'Save', second array element 'Save as', third second array element 'Save and open'
InvokePattern clickMenu = (InvokePattern)currentMainWindowDialogElement.FindAll(TreeScope.Children, Condition.TrueCondition)[1].GetCurrentPattern(AutomationPattern.LookupById(10000));
clickMenu.Invoke();
Thread.Sleep(1);
ControlSaveDialog(mainWindow, filename);
break;
//strt
//end
}
}
}
}
}