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 

Determine a "Next Run" day

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



Joined: 28 Dec 2006
Posts: 362

PostPosted: Wed Apr 11, 2007 11:38 am    Post subject: Determine a "Next Run" day Reply with quote

If I have an ini file as follows:

Code:
[Details]
LastRan=Wed Apr 11th at 05:09
[Occurrence]
Friday=0
Saturday=1
Sunday=0
Monday=0
Tuesday=0
Wednesday=1
Thursday=0


and a script that checks if A_DDDD is equal to 1, if so then do something and update the "LastRan" value by iniwrite ... I want to include in my code the ability to pop up a message box to see when the "next run" day will be... so if this certain ini file was last ran Wednesday, the next run date will be Saturday, since Thursday and Friday are 0's... how would I do this? It would also be nice if this was not just day specific, but month specific also... so if the last ran day was for instance Wednesday of March, then the next run date would be today, Wednesday of April...

this seems to be to complicate for me to figure out, can anyone offer any ideas?

Thanks!!

Adam
Back to top
View user's profile Send private message
BoBo
Guest





PostPosted: Wed Apr 11, 2007 11:57 am    Post subject: Reply with quote

Why not check the help for Gui/Add/MonthCal ?

Code:
Gui, Add, MonthCal, vMyCalendar gMyCalendar
Gui, Show
Return

MyCalendar:
FormatTime, Date, %MyCalendar%, WDay
If Date = 4 ; wednesday
   MsgBox It's Wednesday
Return
Mix it with INIRead/-Write ...
Back to top
adamrgolf



Joined: 28 Dec 2006
Posts: 362

PostPosted: Thu Apr 12, 2007 6:46 am    Post subject: Reply with quote

Hmm, is there no way to determine the next run day like I mentioned in the first post without using this monthcal thing? I dont think I want to use it
Back to top
View user's profile Send private message
BoBo
Guest





PostPosted: Thu Apr 12, 2007 7:39 am    Post subject: Reply with quote

Code:
FormatTime, LastRunDate, , LongDate
FormatTime, DayName, , dddd
INIRead, Day, My.ini, Occurrence, %DayName%
If Day = 1
{
   MsgBox Today is the day!
   INIWrite, %LastRunDate%, My.ini, Details, LastRan
   }
Not tested.
Back to top
adamrgolf



Joined: 28 Dec 2006
Posts: 362

PostPosted: Fri Apr 13, 2007 11:56 am    Post subject: Reply with quote

BoBo, this would only work if I wanted to know if it is going to run today --

Does anyone have any idea how to do what my first post asks?

This baffles me, it is a bit to complicated for me to figure out.

if toady is friday, and my task will run, monday wednesday and friday, and it has already ran today, then when will it run next: the file that determines when a script runs is as follows

Code:
[Details]
LastRan=Fri Apr 13th at 05:09
[Occurrence]
Monday: 1
Tuesday: 0
Wednesday: 1
Thursday: 0
Friday: 1
Saturday: 0
Sunday: 0
Back to top
View user's profile Send private message
Titan



Joined: 11 Aug 2004
Posts: 5068
Location: imaginationland

PostPosted: Fri Apr 13, 2007 12:05 pm    Post subject: Reply with quote

FormatTime only works with the YYYYMMDDHH24MISS date format.
_________________

RegExReplace("irc.freenode.net/ahk", "^(?=(.(?=[\0-r\[]*((?<=\.).))))(?:[c-\x73]{2,8}(\S))+((2)|\b[^\2-]){2}\D++$", "$u3$1$3$4$2")
Back to top
View user's profile Send private message Visit poster's website
bold



Joined: 20 Apr 2006
Posts: 15

PostPosted: Fri Apr 13, 2007 12:41 pm    Post subject: Reply with quote

Check out EnvAdd in the manual. You can do date calculations like this snippet (from the manual):

Code:
var1 =  ; Make it blank so that the below will use the current time instead.
var1 += 31, days
FormatTime, t, %var1%
MsgBox, %t%  ; The answer will be the date 31 days from now.


You should be able to find out the difference in days between the current weekday and the next runday with a loop and the help of A_WDay.

Then you add the number of days to the current day as in the above snippet, format the time and that's it.
Back to top
View user's profile Send private message
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