AutoHotkey Community

It is currently May 25th, 2012, 1:11 am

All times are UTC [ DST ]




Post new topic Reply to topic  [ 7 posts ] 
Author Message
PostPosted: April 11th, 2007, 11:38 am 
Offline

Joined: December 28th, 2006, 9:46 am
Posts: 440
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


Report this post
Top
 Profile  
Reply with quote  
 Post subject:
PostPosted: April 11th, 2007, 11:57 am 
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 ...


Report this post
Top
  
Reply with quote  
 Post subject:
PostPosted: April 12th, 2007, 6:46 am 
Offline

Joined: December 28th, 2006, 9:46 am
Posts: 440
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


Report this post
Top
 Profile  
Reply with quote  
 Post subject:
PostPosted: April 12th, 2007, 7:39 am 
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.


Report this post
Top
  
Reply with quote  
 Post subject:
PostPosted: April 13th, 2007, 11:56 am 
Offline

Joined: December 28th, 2006, 9:46 am
Posts: 440
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


Report this post
Top
 Profile  
Reply with quote  
 Post subject:
PostPosted: April 13th, 2007, 12:05 pm 
Offline
User avatar

Joined: August 11th, 2004, 1:47 am
Posts: 5346
Location: UK
FormatTime only works with the YYYYMMDDHH24MISS date format.

_________________
GitHubScriptsIronAHK Contact by email not private message.


Report this post
Top
 Profile  
Reply with quote  
 Post subject:
PostPosted: April 13th, 2007, 12:41 pm 
Offline

Joined: April 20th, 2006, 9:54 pm
Posts: 21
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.


Report this post
Top
 Profile  
Reply with quote  
Display posts from previous:  Sort by  
Post new topic Reply to topic  [ 7 posts ] 

All times are UTC [ DST ]


Who is online

Users browsing this forum: Alpha Bravo, Bing [Bot], lblb, Rado_K and 11 guests


You can post new topics in this forum
You can reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot post attachments in this forum

Search for:
Powered by phpBB® Forum Software © phpBB Group