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 

Don't seem to work well together?

 
Post new topic   Reply to topic    AutoHotkey Community Forum Index -> Ask for Help
View previous topic :: View next topic  
Author Message
If statements and loops
Guest





PostPosted: Fri Oct 09, 2009 4:46 am    Post subject: Don't seem to work well together? Reply with quote

Let me give you some background information on what I am trying to do here.

What my goal is with this script is for it to check my system clock, if the time in the clock = 09:00, then it should run the program in the directory I have selected.

Everything works fine, just one issue. The script will work if I set the time to load the program equal to the time it currently is then run it. However, if I set the time to run the program a few (I am using 1 just to speed things up) minutes ahead of when I execute the script, it will never run the program.
My if statement is in a loop, this does not solve the issue. The console is checking for the time but for some reason the if will not return true, even if it is.

I'm having a sort of difficult time explaining this..bottom line is..how can I get the script to keep refreshing the if statement? And when the requirements are met..do whats in the {}?

Code:

FormatTime, TimeString, HH:mm, HH:mm
Loop{
If TimeString = 00:45 ;Its 12:45 here
{
Run C:\Program FIles\Program\Program.exe
exit
}
}
Back to top
Z_Gecko
Guest





PostPosted: Fri Oct 09, 2009 5:05 am    Post subject: Reply with quote

Code:
Loop
{
  FormatTime, TimeString, HH:mm, HH:mm
  If TimeString = 00:45 ;Its 12:45 here
  {
    Run C:\Program FIles\Program\Program.exe
    break
  }
}
Back to top
OP
Guest





PostPosted: Fri Oct 09, 2009 5:11 am    Post subject: Reply with quote

Z_Gecko wrote:
Code:
Loop
{
  FormatTime, TimeString, HH:mm, HH:mm
  If TimeString = 00:45 ;Its 12:45 here
  {
    Run C:\Program FIles\Program\Program.exe
    break
  }
}

Thanks
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