Created
March 16, 2020 13:44
-
-
Save mzfr/49831c90a3175671809025718173b769 to your computer and use it in GitHub Desktop.
auto type all of your content
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
#!/usr/bin/env python3 | |
'''This script help to automate the process of writing the | |
large content to places where copy paste might not work. | |
Ex: learning management systems which take code as an input | |
might not allow copy and paste, there we can use this kind of | |
trickery. | |
The only disadvantage of this is that it might fail to provide | |
proper indentation. So that will have to be done manually. | |
''' | |
import subprocess | |
import time | |
# Time to switch tabs, so you can get the cursor | |
# to the position where typing has to be done | |
time.sleep(3) | |
# Path to the file that contains the data to be typed | |
filepath = "code.c" | |
# xdotool is a tool that is used to perform the typing process. | |
# You can install it using your package manager on linux systems. | |
subprocess.call(["xdotool type --file %s --delay 5" % filepath], shell=True) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment