By registering with us, you'll be able to discuss, share and private message with other members of our community.

SignUp Now!

Replace internal date vars with user-set values

Rex indicated that a user-defined variable can have the same name as a TCC internal variable and TCC will look to the user-defined variable before looking to the internal variable.

Example on date 8/18/2018:

echo %_date
{ shows: 8/18/18 }

set _date=Somebody's Birthday
echo %_date
{ shows: Somebody's Birthday}

The attached file takes a sample date in the format YYYYMMDD and changes all the date variables to match that. First it will display the real values, then the fake values, then the real values again.

The purpose of the "date change" routine is for software testing and development of date-based code, such as "Will this code I'm writing in 2018 actually do in February 2019 what I think it will do?"

If the command line includes a date, the program will use that date as the fake value. If there is no date it will use 19501118.


Nice example.

One question.

Except for @monthname[] (Charles Dye's ISO8601 Plugin) why not just use Internal functions and variables?
I originally tried using it only with internal functions, but in a number of instances there is no equivalent internal function. Originally I just copied the _{name}, replaced the underscore with an @ and added [%fd]:

set _varname=%@varname[%fd] e.g.
set _month=%@month[%fd]

Once I found out there isn't a one-to-one correspondence I tried the plugin and it worked. It's only for test and development purposes, so I'm not concerned about optimizing it.
[FOX] Ultimate Translator