Any software to find relevant months from specified day and date number?

  • Thread starter Thread starter Jane D
  • Start date Start date
J

Jane D

I am looking for some calendar software where I can input the
"weekday" and a "date number" and the software then tells me which
months that date fell on that weekday?

For example, if I provided this info: "Friday the 9th in 2004"
then the software would tell me "January, April and July".

I can't find anything in Calendar Magic to do this - unless I am
overlooking something in it.
 
Jane D ([email protected]) schrieb/wrote:
I am looking for some calendar software where I can input the
"weekday" and a "date number" and the software then tells me which
months that date fell on that weekday?

For example, if I provided this info: "Friday the 9th in 2004"
then the software would tell me "January, April and July".

Copy the lines between the "cut here" marks and save them
to a textfile(!) named findmonth.vbs (the name doesn't matter,
the .vbs extension is important).

Doubleclick findmonth.vbs to start the script.

Following input will be accepted:

friday 13 2005
friday 13 (if year is missing, current year will be assumed)
friday 13th
fr 1st (only the first two letters of the day are relevant)
super 3nd (assume sunday (su),
all "st", "nd", "rd" in the number will be discarded)

Enjoy!
Andreas

===== cut here =====
' find relevant months from specified day and date number
' by AcK 21-Jun-2005 (e-mail address removed)
' Freeware for private and commercial use

Option Explicit
Dim inp, result, help

help = "Enter day, number, year" & vbCRLF & _
"Example: Friday 13 2005" & vbCRLF & _
"omit year ==> assume current year" & vbCRLF & vbCRLF

Do
inp = Trim(InputBox(help & result, "Find Months", inp))
result = ""
If inp <> "" Then FindMonths inp
Loop Until inp = ""

WScript.Quit

Sub FindMonths(str)
Dim wrk, datearr, i, wday

datearr = Split(str)
i = UBound(datearr)
If i = 1 Then
ReDim Preserve datearr(i+1)
datearr(2) = Year(Date)
End If
datearr(0) = UCase(Left(datearr(0), 1)) & _
LCase(Mid(datearr(0), 2, Len(datearr(0))))
datearr(1) = Replace(UCase(datearr(1)), "ST", "")
datearr(1) = Replace(UCase(datearr(1)), "ND", "")
datearr(1) = Replace(UCase(datearr(1)), "RD", "")
inp = datearr(0) & " " & datearr(1) & " " & datearr(2)

Select Case UCase(Left(datearr(0), 2))
Case "SU" : wday = 1
Case "MO" : wday = 2
Case "TU" : wday = 3
Case "WE" : wday = 4
Case "TH" : wday = 5
Case "FR" : wday = 6
Case "SA" : wday = 7
End Select
For i = 1 To 12
wrk = datearr(1) & "-" & i & "-" & datearr(2)
If DatePart("w", wrk) = wday Then
result = result & datearr(0) & " " & wrk & vbCRLF
End If
Next

End Sub
===== cut here =====
 
I am looking for some calendar software where I can input the
"weekday" and a "date number" and the software then tells me which
months that date fell on that weekday?

For example, if I provided this info: "Friday the 9th in 2004"
then the software would tell me "January, April and July".

GCal can do this. But beware, it has a very exhaustive syntax. You
get this program here:

http://gnuwin32.sourceforge.net/packages/gcal.htm

If you look at the GCal command line syntax you see this:

gcal [ [option . . . ] [%date] [@file . . . ] ] [command]

If not told otherwise GCal works with the current date in mind.
For this date it pops up calendar sheets, gives you a list of
appointments, evaluates holiday lists, and so on.

Nothing of this will help you much with Fridays in 2004. The %date
parameter makes GCal operating as if today would be another day.
That's, too, not what you'd like to achieve. The @file parameter
only feeds GCal with script files. That's too complicated for your
simple task.

The command parameter, OTOH, permits you to evaluate expressions
defined via 'options' and resource files for specific combinations
of years and months. That's better, isn't it? ;-)

In your case a simple command '2004' will do. To define a span of
years you could use '2002+2004' (that's 2002 up to 2004) or a
list of years like this: '2002;2003;2006'. If you need to select
(spans or lists of) months, too, please consult the docs.

Now we have GCal looking at the time frame we want it to. Next
step is to decide the operation mode. We would like neither some
calendar sheet output nor some date based appointment evaluation.
In fact: We want something which GCal calls 'Fixed date list'.
Therefore our first option is -u (= don't display calendar sheets).

The second option tells GCal to accept a date formula from
command line rather than from resource files (the default).
It's the -# option followed by a string in quotation marks.

If you don't like the subheaders of the output you may include
the -x option as well.

Now to the date formula. Because the target year is already
set as a command (in fact: is has to), the formula can be a
very universal one.

We tell GCal to scan through arbitrary years (= 0 [you could
replace that by 2004 if you better like that]) from first
Friday (= *d1fri) to the last (= #99fri) in steps of 7 days
(= .7). Moreover we only want days included (= %i), which
have any year (= 0000), any month (= 00) and only 9 as a
date (= 09). To finish the include span (= #) we add the
same date (= 00000009) once again.

The whole command line looks those:

gcal -# "0*d1fri#99fri.7 %i00000009#00000009" -u -x 2004

Output redirection (append: > Fri09.txt) sends the results
to (at this example) Fri09.txt.

HTH.
BeAr
 
Jane D said:
I am looking for some calendar software where I can input the
"weekday" and a "date number" and the software then tells me which
months that date fell on that weekday?

For example, if I provided this info: "Friday the 9th in 2004"
then the software would tell me "January, April and July".

I can't find anything in Calendar Magic to do this - unless I am
overlooking something in it.

Calendar Magic will do it, although not very elegantly. Bring up the
Calendar Comparison screen and set say the left-hand calendar to January
in 2004. Left-click day 9 to colour it red for easy visibility. Then use
the month spin button to move quickly through January, February, March
etc. and note any month where the "red 9" is in the Friday column.

If this is a capability you require to use regularly, let me know and
I'll add something better to the next release.

Alex Balfour
 
B. R. 'BeAr' Ederson ([email protected]) schrieb/wrote:

[Full quote intended]
I am looking for some calendar software where I can input the
"weekday" and a "date number" and the software then tells me which
months that date fell on that weekday?

For example, if I provided this info: "Friday the 9th in 2004"
then the software would tell me "January, April and July".

GCal can do this. But beware, it has a very exhaustive syntax. You
get this program here:

http://gnuwin32.sourceforge.net/packages/gcal.htm

If you look at the GCal command line syntax you see this:

gcal [ [option . . . ] [%date] [@file . . . ] ] [command]

If not told otherwise GCal works with the current date in mind.
For this date it pops up calendar sheets, gives you a list of
appointments, evaluates holiday lists, and so on.

Nothing of this will help you much with Fridays in 2004. The %date
parameter makes GCal operating as if today would be another day.
That's, too, not what you'd like to achieve. The @file parameter
only feeds GCal with script files. That's too complicated for your
simple task.

The command parameter, OTOH, permits you to evaluate expressions
defined via 'options' and resource files for specific combinations
of years and months. That's better, isn't it? ;-)

In your case a simple command '2004' will do. To define a span of
years you could use '2002+2004' (that's 2002 up to 2004) or a
list of years like this: '2002;2003;2006'. If you need to select
(spans or lists of) months, too, please consult the docs.

Now we have GCal looking at the time frame we want it to. Next
step is to decide the operation mode. We would like neither some
calendar sheet output nor some date based appointment evaluation.
In fact: We want something which GCal calls 'Fixed date list'.
Therefore our first option is -u (= don't display calendar sheets).

The second option tells GCal to accept a date formula from
command line rather than from resource files (the default).
It's the -# option followed by a string in quotation marks.

If you don't like the subheaders of the output you may include
the -x option as well.

Now to the date formula. Because the target year is already
set as a command (in fact: is has to), the formula can be a
very universal one.

We tell GCal to scan through arbitrary years (= 0 [you could
replace that by 2004 if you better like that]) from first
Friday (= *d1fri) to the last (= #99fri) in steps of 7 days
(= .7). Moreover we only want days included (= %i), which
have any year (= 0000), any month (= 00) and only 9 as a
date (= 09). To finish the include span (= #) we add the
same date (= 00000009) once again.

The whole command line looks those:

gcal -# "0*d1fri#99fri.7 %i00000009#00000009" -u -x 2004

Output redirection (append: > Fri09.txt) sends the results
to (at this example) Fri09.txt.

That sounds a bit primitive to me :)))
 
On Tue 21 Jun 2005 17:56:09, Andreas Kaestner wrote:
Jane D ([email protected]) schrieb/wrote:


Copy the lines between the "cut here" marks and save them
to a textfile(!) named findmonth.vbs (the name doesn't matter,
the .vbs extension is important).

cut


Enjoy!
Andreas

Thank you very much. :-)
 
On Tue 21 Jun 2005 21:30:57, Alex Balfour wrote:
Calendar Magic will do it, although not very elegantly. Bring up
the Calendar Comparison screen and set say the left-hand
calendar to January in 2004. Left-click day 9 to colour it red
for easy visibility. Then use the month spin button to move
quickly through January, February, March etc. and note any month
where the "red 9" is in the Friday column.

If this is a capability you require to use regularly, let me
know and I'll add something better to the next release.

Alex Balfour


Alex, I would welcome some sort of feature to do this calculation.

I am one of those people who make a quick note of something on
paper and write its date as "Tuesday 16th".

Much later on I find that I still have the note and have kept it
for longer than I expected. Then I am left to work out which
month I made the note in. In fact, often I have to work out which
month and which year.

So I am someone who would definitely appreciate it if you could
include something like this capability in the next release of
Calendar Magic. CM is a very comprehensive program and I use it a
lot. Thank you for it.

BTW it would be nice if Calendar Magic would accept ESC as a
shortcut to Return To Main Menu (in addition to Alt-M).
 
On Tue 21 Jun 2005 20:19:10, B. R. 'BeAr' Ederson wrote:



Yikes!

Okay, okay. Let's simplify things a bit. First create a batch file
named Datetest.bat (for instance). After that copy the following
string to the batch (note the additional percent sign before the
letter i beside the other changes):

gcal -# "0*d1%1#99%1.7 %%i000000%2#000000%2" -u -x %3

After you saved this file you can call the batch whenever you want
this way:

Datetest Fri 09 2004

----- End of required operations. Some comments follow. -----

The first parameter is always the day of the week and can have 2
or 3 chars. The second holds the day of the month and has always
to be 2 digits. The last holds the command string. It can be a
simple year like above or a more complex statement like this:

Datetest Th 13 01/2003-11/2007
or
Datetest Th 13 Jan/2003-Nov/2007

(That will check from 1th of January 2003 to the 30th of November
in 2007 for a Thursday, the 13th. Look inside the GCal docs for
all possible combinations.)

Parameter containing a comma or semicolon can only be built with
WinNT based systems like Win2k or WinXP. You'd need to call the
batch via cmd.exe like this:

cmd /c Datetest Fri 04 "2001;2003;2005"

In that case the last parameter has to be enclosed in quotation
marks.

Does it look simpler to you, now? No? Than you have to get one of
those command line replacements which allow shortcuts, ask for
parameters, and so on. Integrate the above Batch into one of those
and life will be as simple as GCal will never get. ;-)

BeAr
 
Alex, I would welcome some sort of feature to do this calculation.

I am one of those people who make a quick note of something on
paper and write its date as "Tuesday 16th".

Much later on I find that I still have the note and have kept it
for longer than I expected. Then I am left to work out which
month I made the note in. In fact, often I have to work out which
month and which year.

So I am someone who would definitely appreciate it if you could
include something like this capability in the next release of
Calendar Magic. CM is a very comprehensive program and I use it a
lot. Thank you for it.

BTW it would be nice if Calendar Magic would accept ESC as a
shortcut to Return To Main Menu (in addition to Alt-M).

Hi Jane,

In V15.6, I've generalised the functionality behind the "Friday the
13th." button to provide what you require. The button is now called "In
Which Months?".

If you would like to try a pre-release beta version of V15.6, I'm happy
to send it to you.
BTW it would be nice if Calendar Magic would accept ESC as a
shortcut to Return To Main Menu (in addition to Alt-M).

This I'm afraid is in the "too tedious to do" list. It's easy to set the
ESC key up in this way for a single control per form, but it will only
work for a user when that control has "the focus". To set it up for all
the relevant controls on 26 different forms is too awful to contemplate.

Best wishes,

Alex
 
This I'm afraid is in the "too tedious to do" list. It's easy to set the
ESC key up in this way for a single control per form, but it will only
work for a user when that control has "the focus". To set it up for all
the relevant controls on 26 different forms is too awful to contemplate.

@Alex: How about using Form-Level Keyboard Handlers?

http://msdn.microsoft.com/library/en-us/vbcon98/html/vbconwritingformlevelkeyboardhandler.asp

@Jane: Maybe an utility for keyboard remapping (like AutoHotkey) can
help you. If you have a NT based system (like Win2k or WinXP) you can
do top-level window specific remapping with AutoHotkey:

http://www.autohotkey.com

Just my thoughts...

BeAr
 
@Alex: How about using Form-Level Keyboard Handlers?
[...]
Thank you for pointing this out. It made implementing the use of the Esc
key a trivial exercise.

Glad I could help. :-) Keep up your good work! Although I prefer
command line solutions for many tasks (as I showed above for GCal),
there are always situations where a GUI comes handy. And not to
forget the (majority ;-) ) of people which feel repelled or
overtasked by seemingly cryptic command sequences...

BeAr
 
Back
Top