Forum Discussion
Oops, I've just noticed you are using Sys.WaitProcess() and not Sys.Process()
Here's an example,
function Notepad()
{
// Assuming Notepad is opened.
var process = Sys.Process("notepad");
// Enter text
process.Window("Notepad", "Untitled - Notepad", 1).Window("Edit", "", 1).SetText("Smartbear"); // Comment out line
// Close application
Sys.Process("notepad").Close();
// Respond to save dialog
if (Sys.WaitProcess("notepad", 5000).Exists)
{
// Click 'don't save' button
process.Window("#32770", "Notepad", 1).UIAObject("Notepad").Window("CtrlNotifySink", "", 8).Window("Button", "Do&n't Save", 1).Click();
}
}
1. Launch Notepad, and run the script.
2. Comment out the SetText() line.
3. Launch Notepad again, and run the script.
The script deals with the 'Do you want to save changes to Untitled?' dialog appearing, as well it not appearing.