クリップボードの値をキーワードを設定して保存するスクリプト
# !/user/bin/env python # mcb.pyw - save and loads pieces of text to the clipboard # Usage: py.exe mcb.pyw save <keyword> - Save clipboard to keyword # py.exe mcb.pyw <keyword> - Loads keyword to clipboard # py.exe mcb.pyw list - Load all keyword to clipboard import shelve, pyperclip, sys def main(): with shelve.open('mcb') as mcbShelf: # Save clipboard content if len(sys.argv) == 3 and sys.argv[1].lower() == 'save': mcbShelf[sys.argv[2]] = pyperclip.paste() elif len(sys.argv) == 2: #List keywords and load content if sys.argv[1].lower() == 'list': pyperclip.copy(str(list(mcbShelf.keys()))) print(str(list(mcbShelf.keys()))) elif sys.argv[1] in mcbShelf: pyperclip.copy(mcbShelf[sys.argv[1]]) if __name__ == '__main__': main()