How do I use type command to enter current date and time ?

Asked by cortneyd

I want to use the 'type ( )' command to put text on my screen that will show the current date and time (down to the second).
Can anyone tell me how to do this?
Thanks

Question information

Language:
English Edit question
Status:
Answered
For:
SikuliX Edit question
Assignee:
No assignee Edit question
Last query:
Last reply:
Revision history for this message
masuo (masuo-ohara) said :
#1

I recommend paste() instead of type().

import datetime
t = datetime.datetime.today()

#Click on the input position of the date
paste(t.strftime("%Y/%m/%d"))

#Click on the input position of the time
paste(t.strftime("%H:%M:%S"))

Can you help with this problem?

Provide an answer of your own, or ask cortneyd for more information if necessary.

To post a message you must log in.