Last active
April 10, 2024 20:49
-
-
Save s4lt3d/cf1df9e09c4be75b3267c14343009c82 to your computer and use it in GitHub Desktop.
This file contains hidden or 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
| # Types out code for videos designed for use in Rider | |
| import pyperclip | |
| import pyautogui | |
| import time | |
| def type_clipboard_content(): | |
| # Get text from clipboard | |
| text = pyperclip.paste() | |
| text = text.replace("\n}", "}") | |
| # Split the text by '}' and iterate through each segment | |
| segments = text.split('}') | |
| for i, segment in enumerate(segments): | |
| # Introduce a short overall delay here if needed | |
| time.sleep(0.1) | |
| # Type out the text segment at once | |
| pyautogui.typewrite(segment, interval=0.01) # Adjust the interval as needed for reliability | |
| # After typing each segment (except the last one), press 'down' instead of typing '}' | |
| if i < len(segments) - 1: # Check if it's not the last segment | |
| pyautogui.press('down') | |
| # Optional: Adjust the delay after pressing down if necessary | |
| time.sleep(0.1) | |
| if __name__ == "__main__": | |
| time.sleep(4) | |
| type_clipboard_content() | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment