How to collect the age of a subject as a variable
Hi,
when starting an experiment, I would like to enter subject ID, date of birth and current date and then have opensesame log the sub_ID and sub_age for every trial/response as a variable. Ideally I would like to log both age in days and years.
I found information on getting the days between dates in python (https://stackoverflow.com/questions/151199/how-do-i-calculate-number-of-days-between-two-dates-using-python) but since I'm new to both OS and python, I'd like to learn from an example solution.
Thanks in advance!

Comments
Hi,
I recommend to use
text_input_forms. You can collect all kinds of information like that.The error message seems to be quite straightforward, it
Good luck,
Eduard
Hi there, i was looking for the same thing.
And probably it would help everyone if there was a python code (based on text_input_form) which is accessible to everyone. So everybody could just paste it into an inline_script and that's it.
It should do the following:
#1 ask for Birthdate in the format DD.MM.JJJJ
#2 calculate diff between experiment_date and Birthday
#3 log the exact age in years (with commas)
Up to now i was not able to manage that.
But maybe @eduard this is an easy thing to do?
Cheers,
Stephan
Thanks for this masterpiece http://osdoc.cogsci.nl/3.2/manual/forms/validation/
I changed the code a little to get the exact age with Birthday.
Here is the code for anyone who is interested
And for those who need an ID_code
Info: use Bday and ID_code
a) to check whether a participants participates twice in the same experiment
b) or whether the same participant participated in two of your experiments
Nice!
Is there a way to change the fontsize?
Thanks,
Sylvain
I always work with these standard settings in the "general options":
Foreground black
Background white
Font mono 18px
With that it looks nice.
Apparently changing fontsize is doable:
http://forum.cogsci.nl/index.php?p=/discussion/507/solved-change-backgrounds-colors-and-fonts-in-widgets
But for some reasons I struggle to do it, for instance:
doesnt seem to work.
Hey, really helpful advice!
It doesn't seem like the form_text_input is supported if you want to make an online experiment. Do you have any advice of what to do then?
Thanks!