Last active
April 12, 2026 11:56
-
-
Save dmn001/3ec1ffa635524bd1c213dc7f7585199d to your computer and use it in GitHub Desktop.
A Python script to paste text from clipboard char by char (updated shortcut to backtick)
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
| import keyboard | |
| import pyperclip | |
| import time | |
| def handle_press(event): | |
| # Retrieve clipboard text | |
| text = pyperclip.paste() | |
| if text: | |
| # A tiny delay prevents the OS from mixing the hotkey with the pasted text | |
| time.sleep(0.05) | |
| keyboard.write(text) | |
| # suppress=True here is more likely to work when using the specific key hook | |
| keyboard.on_press_key('`', handle_press, suppress=True) | |
| print("Active. Press '`' to paste. Press 'Ctrl+Esc' to stop.") | |
| # Changed to Ctrl+Esc to avoid potential conflicts with the backtick hook | |
| keyboard.wait('ctrl+esc') |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment