A text string read from file can be included in a 3D model. The file can contain any printable sting, e. g. the present date. The date can be read from the print and and be used to find the corresponding scad file version or arrange the prints in chronological order. My project runs under Linux, will probably work with Macs.
An Openscad program can read a file using either the include or use functionality. The program can then use the information read to dynamically modify the model. In my case I read a file containing a string representation of the present time and then include this as a engraved timestamp of my model. This example is a cube with an hour and minute time stamp.
The format string following the + command line option for date specifies how the time will be represented. Run man date to find all the format specifier. You can of course change this format string to include year, month etc.
After I start the above script the script will update the scadtime file every minute until killed. Thus the file will hold the present time with one minute resolution. The problem with this is that OpenScad sets notification on the file and will thus detect file changes and generate a new view of the model (like pressing F5). This is very inconvenient if you are at editing the model.
It is therefore better to increase the sleep time to e.g. 3600 seconds. A timestamp with one hour resolution will be fine if you do not reprint the model too often.
An alternative can be to remove the while loop and manually run the script fefore each new modl rendering (F6 press). Needs some discipline to ensure the scadtime file is up to date when needed.