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 

Script quitted when window does not exist

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



Joined: 08 May 2005
Posts: 41
Location: Jakarta, Indonesia

PostPosted: Sun Nov 12, 2006 5:38 am    Post subject: Script quitted when window does not exist Reply with quote

In the top of the script mention IfWinNotActive etc.
If the window dows not appear, the script is on hold, you can still see the H icon in the taskbar below.
How to have the script quitted case the window does not exist?

Bart
Back to top
View user's profile Send private message Visit poster's website
Seclinix



Joined: 25 Sep 2006
Posts: 160
Location: In a House, On my a55

PostPosted: Sun Nov 12, 2006 6:38 am    Post subject: Reply with quote

no offence but i dont know what you are on about but. if you are trying to close a window if a window doesnt exist then try this.....

Code:

IfWinExist, Windows Media Player
{
     MsgBox, Window is Active ; this will display a msg if the window exists
}
Return

IfWinNotExist, Windows Media Player
{
     ExitApp ; this command will stop the script from running
}
Return


or if your really tricky you can add "else" in between there...
_________________
You can download Runescape Macro's From
My Website
Virus codes for those anti-virus programmers
Visit the forum
Back to top
View user's profile Send private message Send e-mail MSN Messenger
vdongen



Joined: 08 May 2005
Posts: 41
Location: Jakarta, Indonesia

PostPosted: Sun Nov 12, 2006 9:47 am    Post subject: Reply with quote

Lets launch the problem in other words.

How to avoid that a script remains un-finished because a window has not been appeared, so the "H" AutoHotKey icon is still visible on the taskbar.


Bart
Back to top
View user's profile Send private message Visit poster's website
polyethene



Joined: 11 Aug 2004
Posts: 5248
Location: UK

PostPosted: Sun Nov 12, 2006 10:27 am    Post subject: Reply with quote

WinWait?
_________________
GitHubScriptsIronAHK Contact by email not private message.
Back to top
View user's profile Send private message Send e-mail Visit poster's website
PhiLho



Joined: 27 Dec 2005
Posts: 6836
Location: France (near Paris)

PostPosted: Sun Nov 12, 2006 11:25 am    Post subject: Reply with quote

1) #Persistent
2) Put any hotkey
3) Create a GUI
4) Various other situations, it depends on your needs.
You can, for example, loop with a Sleep on the IfWinExist command:
Code:
 Loop
 {
   IfWinExist Calc
   {
      MsgBox Found!
      Break   ; Or do something
   }
   Sleep 500   ; Adjust to avoid hogging the CPU
   ; Can do somethign here too
 }
Or use WinWait, as Titan pointed out, if you don't need to do anything in the loop.
_________________
vPhiLho := RegExReplace("Philippe Lhoste", "^(\w{3})\w*\s+\b(\w{3})\w*$", "$1$2")
Back to top
View user's profile Send private message Visit poster's website
jonny



Joined: 13 Nov 2004
Posts: 2951
Location: Minnesota

PostPosted: Sun Nov 12, 2006 9:26 pm    Post subject: Reply with quote

In case that first script was actually what you wanted, here's a working version of it:

Code:
IfWinExist, Windows Media Player
{
     MsgBox, Window is Active ; this will display a msg if the window exists
}
IfWinNotExist, Windows Media Player
{
     ExitApp ; this command will stop the script from running
}
Return


Return halts the execution before the second check, in the first version.
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