Skip to content

Instantly share code, notes, and snippets.

@mlongval

mlongval/date.py

Last active Dec 13, 2015
Embed
What would you like to do?
AutoKey code snippet to insert the current date. The original version did not work, I think because I am using Python3
"""
This is for use in the AutoKey text expander under Linux
The version of this script that came with the program does not work
on my system...
I think it's because I use python3
Returns the current date. in the dd/mm/yyyy format
version 1.0
13/02/2013
mlongval _at_ gmail _dot_ com
NB: hacked together in a few minutes... not really tested
use at your own risk
tags: autokey, date, linux, python3
"""
# imports
import subprocess
# definitions
def decodeAndStrip(value):
value = value.decode("utf-8")
value = value.strip()
return(value)
#end def decodeAndStrip
# main()
theDate = subprocess.check_output('date +"%d/%m/%Y"', shell=True)
keyboard.send_keys(decodeAndStrip(theDate))
#end program
@mlongval

This comment has been minimized.

Copy link
Owner Author

@mlongval mlongval commented Feb 14, 2013

Updated, for error in last line

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.