jay823001 / autokey

Automatically exported from code.google.com/p/autokey
GNU General Public License v3.0
0 stars 0 forks source link

simple code problem #124

Closed GoogleCodeExporter closed 9 years ago

GoogleCodeExporter commented 9 years ago
import time

currtime = time.localtime
sentkey = ""

if store.has_key("currtime"):
    oldtime = store.get_value("currtime")
    sentkey = "[OT:" % oldtime % "]"
else:
    store.set_value("currtime", currtime)
    sentkey = "[NOT STORED]"

keyboard.send_keys(sentkey)

does not sent any keys, how come?

Original issue reported on code.google.com by rienk.bo...@gmail.com on 11 Jun 2011 at 1:47

GoogleCodeExporter commented 9 years ago
To simplify:

import time
keyboard.send_keys(time.localtime)

will disable my keyboard.

Original comment by rienk.bo...@gmail.com on 11 Jun 2011 at 1:54

GoogleCodeExporter commented 9 years ago
Your problem is that time.localtime does not return a string to be sent via the 
keyboard - it is a function object. You need to look at some Python tutorials 
on the datetime module to see how to get a date/time string.

Original comment by cdekter on 12 Jun 2011 at 11:59