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 

if window exist run a process

 
Post new topic   Reply to topic    AutoHotkey Community Forum Index -> Ask for Help
View previous topic :: View next topic  
Author Message
0inprogram



Joined: 06 Dec 2007
Posts: 21
Location: chennai

PostPosted: Sat Dec 15, 2007 2:00 pm    Post subject: if window exist run a process Reply with quote

i m a newbie

i want to execute a set of instructions until a window exists....
then stop the process when the window is closed.

i tried doing this with IfWinExist and loop....

but the process continued even after the window was closed....

wht i tried was something like this....

IfWinExist, windows media player
{
loop
{...........
...........
...........
return
}
}


the script made the process to continue even after the window was closed......

pls help
Back to top
View user's profile Send private message Send e-mail Yahoo Messenger MSN Messenger
tic



Joined: 22 Apr 2007
Posts: 1375

PostPosted: Sat Dec 15, 2007 3:26 pm    Post subject: Reply with quote

NB: You dont put a return at the end of a loop to re-execute it, and also check which SetTitleMatchMode is set.
Back to top
View user's profile Send private message
dmatch



Joined: 15 Oct 2007
Posts: 113

PostPosted: Sat Dec 15, 2007 3:46 pm    Post subject: Re: if window exist run a process Reply with quote

0inprogram wrote:
until a window exists....
then stop the process when the window is closed.

If you meant window exits then try this:
Code:
IfWinExist, AutoHotkey Help
{
   Loop
   {
      MsgBox, ,Test,Help is Running,1
      sleep,2000
      ifWinNotExist, AutoHotkey Help
         break
   }
}
and watch out for case sensitivity of window titles and, as mentioned by Tic, SetTitleMatchMode if necessary.

dmatch
Back to top
View user's profile Send private message
0inprogram



Joined: 06 Dec 2007
Posts: 21
Location: chennai

PostPosted: Sun Dec 16, 2007 6:36 am    Post subject: Reply with quote

i tried the code u posted....
but its working only for the first time after the script is loaded

after tht it doesnt show a response... when the application is opened
Back to top
View user's profile Send private message Send e-mail Yahoo Messenger MSN Messenger
flashmaniac
Guest





PostPosted: Sun Dec 16, 2007 10:03 am    Post subject: try this Reply with quote

0inprogram wrote:
i tried the code u posted....
but its working only for the first time after the script is loaded

after tht it doesnt show a response... when the application is opened


Code:

!1:: ; Alt + 1
IfWinExist, AutoHotkey Help
{
   Loop
   {
      MsgBox, ,Test,Help is Running,1
      sleep,2000
      ifWinNotExist, AutoHotkey Help
         break
   }
   Return
}

Give That A Go...
Otherwise You Could Use The #persistant Function
Back to top
Display posts from previous:   
Post new topic   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