Last active
December 17, 2023 19:31
-
-
Save yarliganfatih/c970be2204735dfd97ce5fd9da051f2d to your computer and use it in GitHub Desktop.
printing codes in blocks with commands
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
import keyboard | |
import time | |
def readFile(path): | |
with open(path, 'r') as file: | |
arr = file.readlines() | |
return arr | |
codeLines = readFile("main.js") | |
line = 0 | |
def writeConsoleLine(): | |
global line | |
while codeLines[line]!="\n": | |
keyboard.write(codeLines[line][:-1]) | |
keyboard.press_and_release("shift+enter") | |
time.sleep(0.05) | |
line+=1 | |
keyboard.press_and_release("enter") | |
line+=1 | |
keyboard.add_hotkey('F9', writeConsoleLine) | |
keyboard.wait('ctrl+q') |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment