AutoHotkey Homepage AutoHotkey Community
Let's help each other out
 
 FAQFAQ   SearchSearch   MemberlistMemberlist   RegisterRegister 
 ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 

Need some help with Auto-close

 
Reply to topic    AutoHotkey Community Forum Index -> Ask for Help
View previous topic :: View next topic  
Author Message
GuestClose
Guest





PostPosted: Thu Mar 18, 2010 5:25 pm    Post subject: Need some help with Auto-close Reply with quote

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

PostPosted: Thu Mar 18, 2010 5:28 pm    Post subject: Reply with quote

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
View user's profile Send private message Visit poster's website
None



Joined: 28 Nov 2009
Posts: 3086

PostPosted: Thu Mar 18, 2010 5:47 pm    Post subject: Reply with quote

Try this
Code:
Loop
{
WinWait Voice - ;Wait for a window whose title starts with Voice -
 WinClose ;Close It
}
Back to top
View user's profile Send private message
GuestClose
Guest





PostPosted: Thu Mar 18, 2010 7:12 pm    Post subject: Reply with quote

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






PostPosted: Thu Mar 18, 2010 7:18 pm    Post subject: Reply with quote

u can use settimer, or just put 2 things in the same loop
Back to top
None



Joined: 28 Nov 2009
Posts: 3086

PostPosted: Thu Mar 18, 2010 7:28 pm    Post subject: Reply with quote

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
View user's profile Send private message
Display posts from previous:   
Reply to topic    AutoHotkey Community Forum Index -> Ask for Help All times are GMT
Page 1 of 1

 
Jump to:  
You can post new topics in this forum
You can reply to topics in this forum


Powered by phpBB © 2001, 2005 phpBB Group