Add the main program

This commit is contained in:
David Todd 2019-02-20 19:32:04 -06:00
parent 119e33edce
commit a43382912a

23
main.py Normal file
View File

@ -0,0 +1,23 @@
import keyboard
import time
# Usage: main.py <delay> <filenames>
def main(filenames, delay):
print("running autotyper, abort by pressing F6")
for filename in filenames:
print("reading %s" % (filename))
with open(filename, "r") as file_handle:
for chars in file_handle.read():
if keyboard.is_pressed("f6"):
print("user aborted")
break
keyboard.write(chars, delay)
if __name__ == "__main__":
print("Starting autotyper in 5s")
time.sleep(5)
import sys
delay = float(sys.argv[1])
filenames = sys.argv[2:]
sys.exit(main(filenames, delay))