OverviewExamples
Window.Close ( |
Window.Close(app_handle, CLOSEWND_SENDMESSAGE);
Sends a close message to the program whose window handle is stored in the variable "app_handle."
Window.Close(app_handle, CLOSEWND_TERMINATE);
Terminates the process of the program whose window handle is stored in the variable "app_handle."
-- Get the titles and window handles of all open windows.
windows = Window.EnumerateTitles();
-- A variable containing text in the title you want to search for.
window_name = "Notepad";
-- Loop through the table of windows.
for handle, title in windows do
-- Check if the window title has the target text.
result = String.Find(title, window_name, 1, false);
-- if the string was found in the title, send the window a close message.
if (result ~= -1) then
Window.Close(handle, CLOSEWND_SENDMESSAGE);
end
end
Finds all open windows with the string "Notepad" in the title and sends each of them a close message.
See also: Related Actions