PDA

View Full Version : Minimizing / hiding other windows outside of AMS


bmreeves1
03-31-2005, 02:55 PM
I am testing AMS to manage some windows. For example, I want it to hide notepad on the click of a button and when I click it again to unhide it in a specific location. Please forgive me but I have read through the posts and I cant find much detail on how to do this. Also, I am not much of a programmer so that is why I am using ams due to its simplicity in other things.

Thanks in advance for the help

Adam
04-01-2005, 12:17 PM
You can minimize Notepad using the following code:


-- 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.Minimize(handle);
end
end


And then to restore


-- 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.Restore(handle);
end
end


Adam Kapilik

stickck
11-22-2005, 11:59 PM
how could i send a command like Enter to that window? would it be like this

-- 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.Enter(handle);
end
end