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 

Setting Entire Script to work only if window exists....

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



Joined: 03 Jan 2010
Posts: 262

PostPosted: Wed Jan 06, 2010 9:31 pm    Post subject: Setting Entire Script to work only if window exists.... Reply with quote

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
View user's profile Send private message AIM Address
Murp|e



Joined: 12 Jan 2007
Posts: 531
Location: Norway

PostPosted: Wed Jan 06, 2010 10:40 pm    Post subject: Reply with quote

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
View user's profile Send private message Visit poster's website
jl34567



Joined: 03 Jan 2010
Posts: 262

PostPosted: Wed Jan 06, 2010 11:22 pm    Post subject: Reply with quote

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
View user's profile Send private message AIM Address
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