in reply to Perl::Tk app to manipulate pasted text on the fly

It's been a while since I used it, but something like Clipboard could simplify your UI a lot (no need for the top text box).

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

Replies are listed 'Best First'.
Re^2: Perl::Tk app to manipulate pasted text on the fly
by arbingersys (Pilgrim) on Feb 02, 2008 at 02:09 UTC
    That actually looks useful for another reason. If you close stringilizer before you paste (on Windows at least), you lose all the data you've copied. I suppose you could use Clipboard to put it in the OS clipboard when the text is stringilized. Then if you closed your data would still be accessible.

    I'll definitely check it out. Thanks.

      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)

        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.

        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.