in reply to Re^2: Perl::Tk app to manipulate pasted text on the fly
in thread Perl::Tk app to manipulate pasted text on the fly

Well.... yeah. what you described is basically half of what I was suggesting.

with Clipboard you can get things from the clipboard, and put things into the clipboard. So you could remove the upper textarea from your UI completely, and just have the (lower) textarea for the perl code, and the "eval" button. Users "copy" arbitrary text in any app so that it is in the clipboard, click the "eval" button, and your app can fetch from the clipboard, run the perl code over it, and put it back in the clipboard. no pasting/re-coping required.

(it would basically be the same as the "clipfilter" script that comes with Clipboard except that instead of executing a single command line app, it would eval code from the textarea)

  • Comment on Re^3: Perl::Tk app to manipulate pasted text on the fly

Replies are listed 'Best First'.
Re^4: Perl::Tk app to manipulate pasted text on the fly
by arbingersys (Pilgrim) on Feb 02, 2008 at 16:35 UTC
    Yeah, the only problem with removing the top text area is I often need to look at the text I'm "stringilizing". For instance, when I paste in tabular data from different sources, sometimes the columns are separated by tabs, sometimes other whitespace, and sometimes bizarrely. It helps to see the data after it's been converted to plain text to get the pattern replacement right.

    I am going to try and implement the Clipboard module, though. It would be easy to add another button to process the clipboard directly, as you suggest, saving the copy-paste steps. I could see how this would be very convenient.

Re^4: Perl::Tk app to manipulate pasted text on the fly
by keck (Acolyte) on Feb 05, 2008 at 13:27 UTC
    This is very cool! This is the kind of thing I find myself making for odd jobs too. I have, as the commenter suggested, used Win32::Clipboard to eliminate the gui entirely though.

    The user would click on an icon to start the program and then anytime they copied text that matched a specific regex into the clipboard, it would be replaced with the munged text, so they could just cut, paste, cut, paste..

    If I can dig it up I'll post it.

      Thanks. I have since added a clipilize button that handles text to and from the clipboard. Please see my update above.

      A blog among millions.