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 

wait for window to be active to execute script?

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



Joined: 09 Oct 2009
Posts: 81

PostPosted: Wed Mar 17, 2010 12:29 pm    Post subject: wait for window to be active to execute script? Reply with quote

is there a way to execute a script when a certain window is opened or comes in focus
i've got the following working but i want it to be running in the background and just wait for the window to open to execute the script instead of hitting a hot key to activate.

Quote:

!t::
WinWaitActive, AutoHotkey Help
if ErrorLevel
{
return
}
else
msgbox Thanks for opening.
return
Back to top
View user's profile Send private message
Murx
Guest





PostPosted: Wed Mar 17, 2010 2:22 pm    Post subject: Reply with quote

--> SetTimer
Back to top
maxgohan



Joined: 09 Oct 2009
Posts: 81

PostPosted: Wed Mar 17, 2010 3:07 pm    Post subject: Reply with quote

k i tried this and it's not working

Quote:

#Persistent
SetTimer, test, 250

return

test:
ifwinactive AutoHotkey Help
msgbox a
return
Back to top
View user's profile Send private message
Leef_me



Joined: 08 Apr 2009
Posts: 5336
Location: San Diego, California

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

It works! just as you wrote it.
What are the symptoms of it not working? If that makes any sense.

Code:
#Persistent
SetTimer, test, 250

return

test:
ifwinactive AutoHotkey Help
msgbox a
return

Back to top
View user's profile Send private message
MasterFocus



Joined: 08 Apr 2009
Posts: 3035
Location: Rio de Janeiro - RJ - Brasil

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

Related: WinTrigger (template)
_________________
"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
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