D
Deleted member 1013995
Guest
I am sorry for bumping this really old topic, but I need a tool that does this and I haven't found anything. I know Bloghat hasn't logged in for years but I am quoting his script just in case someone has made this work or knows a tool that does that thing.Hey, there, I used this as an exercise. I weren't able to find a readymade solution, so bolted several things together to come up with paste+spinning.
It's written in python 2.7 (you need to install it).
Then copy the code below into an txt file, name it pastespin.py and save it.
Put your spuntext next to that file, name it spintaxtext.txt
This program has the following dependencies:
win32clipboard
pyHook
pythoncom
It needs them to access the clipboard outside of the app itself.
Code:# -*- coding: iso-8859-1 -*- """ Created on Thu Sep 19 17:15:59 2013 Bloghat """ import win32clipboard,pyHook,pythoncom,random File_instead_of_Line = True #set to False if you want to use the single line below, true if you want to access the file spinfile = "spintaxtext.txt" #spintext must be in this file (same folder as pastespin.py file) # or spinline = '''{What ever,|How dare you,|What the...} {or, what I wanted to {write|say}|{Things|Thoughts}, I was about to tell|yell}.''' if File_instead_of_Line: fileObj= open(spinfile) spintxt = fileObj.read() spintxt = spintxt.replace('','') else: spintxt = spinline def doClipboard(spinnedtext): win32clipboard.OpenClipboard() win32clipboard.EmptyClipboard() win32clipboard.SetClipboardText(spinnedtext) win32clipboard.CloseClipboard() def OnKeyboardEvent(event): if event.Ascii == 22: doClipboard(spin(spintxt)) def spin(content): start = content.find('{') end = content.find('}') if start == -1 and end == -1: #none left return content elif start == -1: return content elif end == -1: raise "unbalanced brace" elif end < start: return content elif start < end: rest = spin(content[start+1:]) end = rest.find('}') if end == -1: raise "unbalanced brace" return content[:start] + random.choice(rest[:end].split('|')) + spin(rest[end+1:]) # create a hook manager hm = pyHook.HookManager() # watch for all events hm.KeyDown = OnKeyboardEvent # set the hook hm.HookKeyboard() # wait forever pythoncom.PumpMessages()