| View previous topic :: View next topic |
| Author |
Message |
jl34567
Joined: 03 Jan 2010 Posts: 262
|
Posted: Wed Jan 06, 2010 9:31 pm Post subject: Setting Entire Script to work only if window exists.... |
|
|
Trying to make a script that only works if a window exists. I'd like to have this auto run every 3-5 minutes. Not sure how to get it to auto run once and terminate the script if it isn't running:
| Code: | greenlight=0
SetTitleMatchMode, 2
IfWinExist, "username that appears in Window title for each person"
greenlight=1
if greenlight=0
MsgBox, Program either not running or you are not authorized to use this script. Please go to some URL for information.
[b]Auto exit<========Possible?[/b] |
I guess I could set a master counter each time function and set them to check for the window every 100 functions or so, but I would eally like to have a single function that runs everyonce in a while. |
|
| Back to top |
|
 |
Murp|e
Joined: 12 Jan 2007 Posts: 531 Location: Norway
|
Posted: Wed Jan 06, 2010 10:40 pm Post subject: |
|
|
| Quote: | | Auto exit<========Possible? | ExitApp?
| Quote: | | I'd like to have this auto run every 3-5 minutes. Not sure how to get it to auto run once | Either by using the windows task scheduler, or using a timer, or loop+sleep.
| Quote: | | terminate the script if it isn't running | Isn't that something of a contradiction?
I don't understand what you're trying to accomplish or why, but I'll post this all the same as you may find something helpful. |
|
| Back to top |
|
 |
jl34567
Joined: 03 Jan 2010 Posts: 262
|
Posted: Wed Jan 06, 2010 11:22 pm Post subject: |
|
|
I meant if a particular program isn't running.
The program Window title has a user name in it, so I don't want the script to run if it isn't the proper user.
This helps a lot.
Thank you |
|
| Back to top |
|
 |
|