Forum Discussion
Dmitry_Nikolaev
14 years agoStaff
Hello Tom,
I recommend that you use the Sys.WaitProcess method to wait for a process. The following script waits for the Notepad process and closes it without saving the changes.
procedure Test1;
var notepad : OleVariant;
var wndNotepad : OleVariant;
begin
notepad := Sys.WaitProcess('Notepad', 10000);
if( notepad.Exists) then
begin
wndNotepad := notepad.Window('Notepad');
wndNotepad.Close();
if (notepad.WaitWindow('#32770', 'Notepad').Exists) then
notepad.WaitWindow('#32770', 'Notepad').Keys('n');
end;
end;