using LoginPI.Engine.ScriptBase; using System; public class newWindowListenerInteractor : ScriptBase { private void Execute() { /* -Disclaimer: This workload is provided as-is and might need further configuration and customization to work successfully in each unique environment. For further Professional Services-based customization please consult with the Login VSI Support and Services team. Please refer to the Help Center section "Application Customization" for further self-help information regarding workload crafting and implementation. -Run the workload against the "target" using Script Editor to ensure it will work before uploading it and testing with it -Go through the workload to understand what it's doing. Comment out any unneeded app tests (code blocks) or add on any needed functional testing -Workload version and changelist: --V1.0 | original -Leave Application running compatibility: false Workload developed with: -Login PI ScriptingToolSet ver. 3.5.9 -Windows 10 x64 Pro winver 1903 18362.356 This script will: -Look for a window title, in a loop -Interact with the Window using defined functions -Loop for defined amount of times Please update the following variables: */ int EndNumber = 9999; // Define how many times the window listener loop code will run; example: 9999 string WindowTitleName = "window name"; // Put the unique window title to listen for here; example: "Notepad" int StartNumber = 0; while(StartNumber < EndNumber) { StartNumber++; var ListenForWindowName = FindWindow(title:WindowTitleName,timeout:1,continueOnError:true); if (ListenForWindowName != null) { // If the window appears then this "if" code block will interact with it. // In this example the className Text:TextBlock is being looked for with the title "Password". If it's seen then the field will be typed to: Password123, and the Enter key to close the popup window. //Replace this code with whichever actions should take place once the window appears. Some examples: clicking an OK button, closing out of the window, or typing some text into a field ListenForWindowName.Focus(); var LookForTextField = ListenForWindowName.FindControl(className : "Text:TextBlock", title : "Password",timeout:1,continueOnError:true); if (LookForTextField != null) { LookForTextField.Type("Password123{ENTER}",cpm:999); } } Wait(0.1); } } }