Sign in to follow this  
Followers 0
tonsafun

Window Techniques

5 posts in this topic

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

Share this post


Link to post
Share on other sites



#2 ·  Posted (edited)

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

Share this post


Link to post
Share on other sites

#3 ·  Posted (edited)

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

Share this post


Link to post
Share on other sites

#4 ·  Posted (edited)

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

Share this post


Link to post
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


Only $2.00 with Resale Rights How to Block Better for Martial Artists and NonMartial Artistshttp://kirkhamsebooks.com/MartialArts/Bloc...tterEbook_m.htm

Share this post


Link to post
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
Sign in to follow this  
Followers 0