mirror of
https://github.com/alopexc0de/autotyper.git
synced 2024-12-21 13:42:39 +00:00
Add the main program
This commit is contained in:
parent
119e33edce
commit
a43382912a
23
main.py
Normal file
23
main.py
Normal 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))
|
Loading…
Reference in New Issue
Block a user