0

I am trying to find a way to have multiple hotkeys that will paste different strings in windows.

currently using (from so):

import os

def add_to_clipboard(text):
    command = 'echo ' + text.strip() + '| clip'
    os.system(command)

add_to_clipboard("this string is now in clipboard")

which will paste when Ctrl + v is pressed. Is there a way using os to add another command to os system that will paste when I press another custom hotkey, such as Alt + space?

shell
  • 1,867
  • 4
  • 23
  • 39
  • I think you need to have a look at this [answer](http://stackoverflow.com/questions/292095/polling-the-keyboard-detect-a-keypress-in-python) – Chiheb Nexus May 07 '17 at 01:43
  • [This project](https://github.com/n0xew/MultiClip) claims to do what you're after. You could look at the source code [here](https://github.com/n0xew/MultiClip/blob/master/Data/MultiClip.py) to see how. – kabdulla May 07 '17 at 01:46
  • If you're willing to consider something other than Python then AutoHotKeys does what you want and much more. – Bill Bell May 07 '17 at 03:22

0 Answers0