| View previous topic :: View next topic |
| Author |
Message |
vdongen
Joined: 08 May 2005 Posts: 41 Location: Jakarta, Indonesia
|
Posted: Sun Nov 12, 2006 5:38 am Post subject: Script quitted when window does not exist |
|
|
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 |
|
 |
Seclinix
Joined: 25 Sep 2006 Posts: 160 Location: In a House, On my a55
|
Posted: Sun Nov 12, 2006 6:38 am Post subject: |
|
|
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 |
|
 |
vdongen
Joined: 08 May 2005 Posts: 41 Location: Jakarta, Indonesia
|
Posted: Sun Nov 12, 2006 9:47 am Post subject: |
|
|
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 |
|
 |
polyethene
Joined: 11 Aug 2004 Posts: 5248 Location: UK
|
Posted: Sun Nov 12, 2006 10:27 am Post subject: |
|
|
WinWait? _________________ GitHub • Scripts • IronAHK • Contact by email not private message. |
|
| Back to top |
|
 |
PhiLho
Joined: 27 Dec 2005 Posts: 6836 Location: France (near Paris)
|
Posted: Sun Nov 12, 2006 11:25 am Post subject: |
|
|
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 |
|
 |
jonny
Joined: 13 Nov 2004 Posts: 2951 Location: Minnesota
|
Posted: Sun Nov 12, 2006 9:26 pm Post subject: |
|
|
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 |
|
 |
|