good chemistry is complicated, and a little bit messy -LW |
|
PerlMonks |
comment on |
( [id://3333]=superdoc: print w/replies, xml ) | Need Help?? |
I use NT4 and Win2K at work. My main use for Perl is as a productivity tool, and a lot of the scripts I use take the text out of the Win32::Clipboard, do something to it, then put it back. I then make a shortcut (.lnk) to the script, put it in Accessories in my Start menu, and assign a double bucky to it. I can then run my transforms by copying the source info into the clipboard, hit the magic key, watch the black box of a command prompt flicker in and out of view (sometimes takes a second on NT, much quicker on Win2K), then paste the results. The most recent one I did was this:
Then I can build up mathematical equations in my text editor, and evaluate them without having to run Calculator and alt-tab back and forth all the time. Update: Added X and x functions to convert to hex. Other tricks include converting a vertical list of values into a comma-separated quoted list that breaks after 72 characters, trim all trailing spaces, adding <href=" to the start and "></a> to the end (I've used that one a couple of times in this writeup), convert < and > to < and > (and I'm considering writing one that prepends and appends <code> and </code>!), and the one that I use perhaps the most, does nothing apart from read the clipboard, and write it back again. Why? Because it throws away any formatting. If you right-click and copy a URI in IE, and paste it into Outlook, it becomes a .URL attachment. If I hit the appropriate key, then it gets pasted in as plain text. If I hit another key, it gets wrapped in a <a href=""></a> tag set ready for pasting into an HTML file, a Slashdot comment, or a Perl Monks writeup. I just wrote the <CODE></CODE> wrapper, it took me exactly one minute to write it (excluding the later addition of the <code></code> protection), make the shortcut, move it into the Start menu, and assign a key to it. The code looks like this (it's a Windows NT command file, for those lucky enough to have never encountered one before): At first I was breaking the </CODE> by inserting </CODE><CODE> inside it, but it appears that if there are line breaks within the <CODE></CODE> block, then it is assumed that there should be one at the end as well. Then I used <pre> instead of <code> in this writeup in order to get that last </CODE> to display correctly. Now I just change the original perl code so that it no longer contains </code>. My head really hurts. In addition, of course, I write the occasional I/O filter for text file transformations or greps, but there's nothing innovative about them. Update: Is there a way to do this kind of thing in Linux? In reply to Clipboard transform keys by PhilHibbs
|
|