Last active
December 13, 2015 17:39
-
-
Save mlongval/4950010 to your computer and use it in GitHub Desktop.
AutoKey code snippet to insert the current date. The original version did not work, I think because I am using Python3
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
""" | |
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 |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Updated, for error in last line