Jump to content

Window Techniques


Recommended Posts

well what i am trying to do is, if a window does not match a certain title, auto it kills the window, and keeps killing windows until the title matches, but when the title matches i want it to do something else. any help is appreciated here

Link to comment
Share on other sites

Try this, and RTFM

While 1
   For c$ 1 to Int(Random(10))
      Send("!{TAB}")
   Next
   If WinGetTitle("") == "The title I want" Then
    ;Do what I want with that window
   Else
      If WinGetTitle("") <> "Program manager" Then
         WinClose(WinGetTitle(""))
      EndIf
   EndIf
   Sleep(60000)
Wend

Edit: typo

Edited by ezzetabi
Link to comment
Share on other sites

well this is what i wanted at the time, but now is this possible?

specify certain titles and autoit only allows these window titles to be open, if a window opens with a different title, it should immediately be killed.

Edited by tonsafun
Link to comment
Share on other sites

This should be simpler...I would first run the script that is posted previously to set-up all the windows that are currently opened. Here is how I would change the script:

$MyTitle = "This is the title I want"

While WinGetTitle("") <> "Program Manager"
  If WinGetTitle("") == $MyTitle Then
      WinSetState($MyTitle,,@SW_MINIMIZE)
  Else
        WinClose(WinGetTitle(""))
  EndIf
  Send("!{TAB}")
Wend

WinSetState($MyTitle,,@SW_RESTORE)

While 1
   $CurrentTitle = WinGetTitle("") 
   If $CurrentTitle <> $MyTitle Then WinClose($CurrentTitle)
WEnd

I think this should work without any problems.

red

Edited by redndahead
Link to comment
Share on other sites

Try this, and RTFM

While 1
   For c$ 1 to Int(Random(10))
      Send("!{TAB}")
   Next
   If WinGetTitle("") == "The title I want" Then
    ;Do what I want with that window
   Else
      If WinGetTitle("") <> "Program manager" Then
         WinClose(WinGetTitle(""))
      EndIf
   EndIf
   Sleep(60000)
Wend

Edit: typo

My over caffein stimulated slightly ADHD brain created someone's signature file

Wow

Rick

Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
 Share

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...