Minimizing / hiding other windows outside of AMS

Collapse
X
 
  • Filter
  • Time
  • Show
Clear All
new posts
  • bmreeves1
    Forum Member
    • Mar 2005
    • 1

    Minimizing / hiding other windows outside of AMS

    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
    Indigo Rose Staff Member
    • May 2000
    • 2149

    #2
    You can minimize Notepad using the following code:

    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

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

    Comment

    • stickck
      Indigo Rose Customer
      • Feb 2004
      • 617

      #3
      how could i send a command like Enter to that window? would it be like this
      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.Enter(handle);
          end
      end

      Comment

      Working...
      X