Topic: get data about system date fulldate.vdm (1 of 12), Read 44 times, 1 File Attachment
Conf: VEDIT Macro Library
From: Scott Lambert
Date: Thursday, June 03, 2010 06:40 PM

Fulldate is a submacro that takes the system date and generates the following info for
the calling macro:

t-reg 1 = date with month spelled out
(example: June 15, 2010)

t-reg 2 = month name only
(January to December)

n-reg 1 = number of days in month
(28 to 31)

n-reg 2 = month number
(1 to 12)

n-reg 3 = current day
(1 to 31)

n-reg 4 = year
(4 digits)

n-reg 5 = leap year flag 0=no 1=yes
(also saved in return_value)

n-reg 6 = number of days since start of year

No matter what your macro needs with the system date,
a call_file to fulldate.vdm is probably in order.

Scott

 
Fulldate.vdm - data from system date

 


Topic: get data about system date fulldate.vdm (2 of 12), Read 33 times
Conf: VEDIT Macro Library
From: Peter Rejto
Date: Thursday, June 03, 2010 11:43 PM

Scott,

I find your fulldate.vdm interesting.

I wonder how far are you from having calendar ?

It certainly would be nice to have a calendar in Vedit.

(I tried to do it myself, but it turned out to be too difficult for me.)

-peter

 


Topic: get data about system date fulldate.vdm (3 of 12), Read 37 times
Conf: VEDIT Macro Library
From: Scott Lambert
Date: Friday, June 04, 2010 04:10 PM


Hi Peter,

No, I have never tried to write a calendar macro. The trick would be the code that figures out
which day of the week the month is suppose to start on. My understanding is you need a known
base date, say January 1st, 2000 which was a Saturday. Then you would need a submacro to
calculate the number of days between the base date, and the first of the month/year specified.
(I actually have written such a macro daysdate.vdm to calulate the number of days between 2
dates, just have not got around to posting it.) Then you can (I think) do some math (the tricky part) to figure out which day of the week the month is suppose to start on.

To simplify things you would need seven data file that have a 31 day month mapped out in the
usual calendar grid format. You would need 7 data files, as the first can occur on any of 7 days (Sun to Sat). Then to correct for months with less then 31 days, you would use a replace
command such as

replace("31"," ", noerr) // that is two spaces in the replace side.

This deletes the unwanted day. The same command could also do the 30th and the 29th for February.

That could be the second submacro. Load the correct data file, and adjust for the correct number of days. My fulldate.vdm submacro could be altered to provide the correct number of
days.

And of course you would need code or submacro to determine leap years.

So a calendar program is certainly possible. You could after the macro has displayed the calendar ask for the day of the month and then bring up a notes file for that date.

But for what you can buy a cheap day planner for, why bother?

Scott


On 6/3/2010 11:43:04 PM, peter rejto wrote:
>Scott,
>
>I find your fulldate.vdm
>interesting.
>
>I wonder how far are you from
>having calendar ?
>
>It certainly would be nice to
>have a calendar in Vedit.
>
>(I tried to do it myself, but
>it turned out to be too
>difficult for me.)
>
>-peter

 


Topic: get data about system date fulldate.vdm (4 of 12), Read 35 times
Conf: VEDIT Macro Library
From: Pauli Lindgren
Date: Wednesday, June 09, 2010 05:05 AM

On 6/4/2010 4:10:06 PM, Scott Lambert wrote:
>
>No, I have never tried to
>write a calendar macro. The
>trick would be the code that
>figures out
>which day of the week the
>month is suppose to start on.

That is actually quite simple.
To find out which weekday it is today, just execute:

#7 = JDate() % 7

#7 will be the weekday number, where 0 = Sunday.

To find out weekday of a specific date, you can use:

#7 = JDate("06/09/2010") % 7

Some example of manipulating dates with Vedit can be found at Roetta Code:
http://rosettacode.org/wiki/Category:Vedit_macro_language

see for example the pages 'Date format' and 'Day of the week'.

--
Pauli

 


Topic: get data about system date fulldate.vdm (7 of 12), Read 41 times, 1 File Attachment
Conf: VEDIT Macro Library
From: Pauli Lindgren
Date: Thursday, June 10, 2010 05:12 AM

Here is a calendar macro I just made.

It opens a small window to display one month calendar.
By default, it displays current months calendar.
Today's day number is highlighted by setting a block.

To create a calendar for some other month, first set #1=month and #2=year, then call the label SET_MONTH, for example:
#1 = 12
#2 = 2010
Call_File(100,"calendar.vdm", "SET_MONTH")

The macro could be easily modified e.g. to display a full year calendar suitable for printing.

The macro uses the file calendar.syn to add some color. It is included in the zip file.

--
Pauli

 
calendar.vdm, calendar.syn

 


Topic: get data about system date fulldate.vdm (8 of 12), Read 38 times
Conf: VEDIT Macro Library
From: Peter Rejto
Date: Wednesday, September 08, 2010 02:27 AM

On 6/10/2010 5:12:37 AM, Pauli Lindgren wrote:
>Here is a calendar macro I
>just made.
>
>It opens a small window to
>display one month calendar.
>By default, it displays
>current months calendar.
>Today's day number is
>highlighted by setting a
>block.
>
>To create a calendar for some
>other month, first set
>#1=month and #2=year, then
>call the label SET_MONTH, for
>example: #1 = 12#2 =
>2010Call_File(100,"calendar.vd
>m", "SET_MONTH")
>The macro could be easily
>modified e.g. to display a
>full year calendar suitable
>for printing.
>
>The macro uses the file
>calendar.syn to add some
>color. It is included in the
>zip file.
>
>--
>Pauli


Thanks,

I just wanted to let you know that it works like a charm.

Incidentally, I do appreciate your option of,

Syntax_Load("|(USER_MACRO)\calendar.syn")

In other words, I do have the option of putting the calendar.syn file into my USER_MACRO directory.
In fact, my USER_MACRO directory is not part of my HOME directory. This way, my "user files" are not part of my HOME directory either. So, if I accidentally erase my HOME directory, no harm done. I just reinstall Vedit.


Also, I have New Year's resolution: My Vedit HOME directory should be untouched by human hands.


Actually, I would like to use a slight adaptation of your idea. Specifically, I would like to create a user_syn sub directory of my USER_MACRO directory. Then I would move calendar.syn into this new sub directory.

In other words, I have grouped my .syn files into two groups. In the first one I kept the ones that came with Vedit. I put the various third party .syn files into the second group. For example I shall put the tex.syn file and into this sub directory as well. Since this file refers to Fritz, I think that this is reasonable.

In any case, I would appreciate hearing from Fritz whethe or not he did more work on the official tex.syn file, which is dated 2002.


Since I also grouped my .mnu files into these two groups, this grouping came natural for the .syn files.



-peter

 


Topic: calendar.vdm v1.1 (9 of 12), Read 64 times, 1 File Attachment
Conf: VEDIT Macro Library
From: Pauli Lindgren
Date: Monday, September 13, 2010 08:43 AM

On 9/8/2010 2:27:54 AM, peter rejto wrote:
>
>Incidentally, I do appreciate your
>option of,
>
>Syntax_Load("|(USER_MACRO)\calendar.syn"
>)
>
>In other words, I do have the option of
>putting the calendar.syn file into my
>USER_MACRO directory.

Actually it is better to use the format
Syntax_Load("calendar.syn")
without the path.
Vedit then automatically loads the syntax file from USER_MACRO directory, or if not found, from Vedit home directory.
If you use some other directory, then you need to give the full path.

By the way, I made a new version of calendar.vdm, v1.1, but it seems I never posted it here. So here it is.

This version has an interactive mode option. To use it, call the label "VIEW", like this:
Call_File(100,"calendar.vdm","VIEW")

In interactive mode, the current months calendar is first displayed. You can move to next/previous month with PgDn/PgUp keys. To close calendar window, press space, esc or any letter key.

In addition, this macro has optional pull-down and pull-up effects. Those can be enabled/disabled independently by setting #3 near the beginning of the macro.

--
Pauli

 
Calendar.vdm v1.1

 


Topic: calendar.vdm v1.1 (10 of 12), Read 43 times
Conf: VEDIT Macro Library
From: Peter Rejto
Date: Sunday, January 23, 2011 11:54 PM

On 9/13/2010 8:43:01 AM, Pauli Lindgren wrote:

>By the way, I made a new version of
>calendar.vdm, v1.1, but it seems I never
>posted it here. So here it is.
>
>This version has an interactive mode
>option. To use it, call the label
>"VIEW", like this:
>Call_File(100,"calendar.vdm","VIEW")
>
>In interactive mode, the current months
>calendar is first displayed. You can
>move to next/previous month with
>PgDn/PgUp keys. To close calendar
>window, press space, esc or any letter
>key.
>
>In addition, this macro has optional
>pull-down and pull-up effects. Those can
>be enabled/disabled independently by
>setting #3 near the beginning of the
>macro.
>
>--


Thanks Pauli,

I like the new "VIEW" option very muchand use it quite a lot.

I also would like to use the pull up and pull down options that you mentioned. However, I can not.

Thanks again,

-peter

 


Topic: calendar.vdm v1.3 (11 of 12), Read 42 times, 1 File Attachment
Conf: VEDIT Macro Library
From: Ted Green
Date: Wednesday, January 26, 2011 05:22 PM

I have modified calendar.vdm to properly size the pop-up
window according to the current font size.

Tentatively I plan to include calendar.vdm in the distribution
and add it to the default {USER} menu.

I noticed that the calendar list as week as Monday through
Sunday, whereas the norm in the US is Sunday through Saturday.
Therefore I may change that.

Thank you again Pauli for writing it. The pull_down and
pull_up routines are especially clever!

Ted Green

 
CALENDAR.VDM (4KB)

 


Topic: calendar.vdm v1.3 (12 of 12), Read 38 times
Conf: VEDIT Macro Library
From: Peter Rejto
Date: Sunday, January 30, 2011 02:41 PM

Thanks Ted,

Calendar.vdm is one of my favorite macros.
So, I am looking forward to the Vedit 6.2 when I will be able to use it directly.


-peter

 


Topic: get data about system date fulldate.vdm (5 of 12), Read 27 times
Conf: VEDIT Macro Library
From: Pauli Lindgren
Date: Wednesday, June 09, 2010 05:15 AM

On 6/3/2010 6:40:39 PM, Scott Lambert wrote:
> Fulldate is a submacro that
> takes the system date and
> generates the following info for
> the calling macro:

There is a problem with the macro. It only works if US date format is selected as default.

To fix this, change the date(...) command into:

date(nomsg+nocr+normal)

--
Pauli

 


Topic: get data about system date fulldate.vdm (6 of 12), Read 24 times
Conf: VEDIT Macro Library
From: Scott Lambert
Date: Wednesday, June 09, 2010 11:52 AM


Thanks for the tips, Pauli. Appreciated. Scott


On 6/9/2010 5:15:37 AM, Pauli Lindgren wrote:

>There is a problem with the macro. It
>only works if US date format is selected
>as default.
>
>To fix this, change the date(...)
>command into:
>
>date(nomsg+nocr+normal)
>
>--
>Pauli