| View previous topic :: View next topic |
| Author |
Message |
GuestClose Guest
|
Posted: Thu Mar 18, 2010 5:25 pm Post subject: Need some help with Auto-close |
|
|
I'm sure this has been done before but I couldn't find any good examples with search.
I have this new stupid software that wants to pop-up every time a client calls and hangs up. Window pictured below. The Title can change depending at the time.
I've tried putting this together from examples and documentation at [url="http://www.autohotkey.com/docs/commands/WinClose.htm"]#WinClose[/url] and [url="http://www.autohotkey.com/docs/commands/_IfWinActive.htm"]#IfWinActive[/url] but I don't think I'm doing ii right at all. They don't work that is.
| Code: |
Loop
{
IfWinExist, WinText "Voice"
WinClose
}
|
| Code: |
Loop
{
IfWinExist, WinText [Voice]
WinClose ; use the window found above
}
|
I might also need some help making sure it doesn't close google voice if I open that tab :\
Thanks! |
|
| Back to top |
|
 |
MasterFocus
Joined: 08 Apr 2009 Posts: 3035 Location: Rio de Janeiro - RJ - Brasil
|
Posted: Thu Mar 18, 2010 5:28 pm Post subject: |
|
|
1) Wrong place. Should have posted it here.
2) Check WinTrigger.
You should use Voice, no [] or "" there.
Also, SetTitleMatchMode and WinTitle Alternatives. _________________ "Read the manual. Read it again. Search the forum.
Try something before asking. Show what you've tried."
Antonio França
My stuff: Google Profile |
|
| Back to top |
|
 |
None
Joined: 28 Nov 2009 Posts: 3086
|
Posted: Thu Mar 18, 2010 5:47 pm Post subject: |
|
|
Try this | Code: | Loop
{
WinWait Voice - ;Wait for a window whose title starts with Voice -
WinClose ;Close It
} |
|
|
| Back to top |
|
 |
GuestClose Guest
|
Posted: Thu Mar 18, 2010 7:12 pm Post subject: |
|
|
| None wrote: | Try this | Code: | Loop
{
WinWait Voice - ;Wait for a window whose title starts with Voice -
WinClose ;Close It
} |
|
This works perfectly, Thanks!
I added another to handle a different window with a slightly different name. Not sure if there is a way to combine them into the same script.
| Code: | Loop
{
WinWait Active Voice -
WinClose
} |
After searching around I see a lot of other cool things to be done with AHK, I'll be playing with it some more and install it at home. |
|
| Back to top |
|
 |
Guest
|
Posted: Thu Mar 18, 2010 7:18 pm Post subject: |
|
|
| u can use settimer, or just put 2 things in the same loop |
|
| Back to top |
|
 |
None
Joined: 28 Nov 2009 Posts: 3086
|
Posted: Thu Mar 18, 2010 7:28 pm Post subject: |
|
|
If you set this SetTitleMatchMode in mode two at the top of your script it would get both windows.
See also GroupAdd | Code: | GroupAdd, KillIt , Voice -
GroupAdd, KillIt , Active Voice -
Loop
{
WinWait ahk_group KillIt ;Wait for a window whose title is in the group
WinClose ;Close It
} |
|
|
| Back to top |
|
 |
|