Results 1 to 3 of 3

Thread: klipper action.. text substitution regex

  1. #1
    Join Date
    Jun 2010
    Beans
    69

    Question klipper action.. text substitution regex

    I'm trying to make an action that replaces part of the clipboard text.
    I'm not sure if my regex is wrong, or if I am just making the action wrong.

    eg: I copy this text to clipboard:
    ftp://user@ftp.site.com/public_html/...001-y600px.jpg
    and the action uses this regex to alter the text
    s/^ftp:\/\/user\@ftp\.site\.com\/public_html\//http://site\.com\/
    to convert
    ftp://user@ftp.site.com/public_html/...001-y600px.jpg
    into
    http://site.com/2013/0001-y600px.jpg

    But then I get lost with adding the "command" and "output handling" sections to the klipper action.
    I have selected the "add to clipboard" option for "output handling" so I assume should see the new text on the clipboard.....?

    Can anyone help me out?

  2. #2
    Join Date
    Jun 2010
    Beans
    69

    Re: klipper action.. text substitution regex

    Code:
     ftp://user@ftp.site.com/public_html
    works fine as the regular expression to allow klipper to recognise it as a valid action string and show it in the menu...
    Code:
    echo firefox %s | sed 's/^ftp:\/\/user\@ftp\.site\.com\/public_html\//http://site\.com/' >>/tmp/output.txt
    works as expected..
    However:
    Code:
    echo %s | sed 's/^ftp:\/\/user\@ftp\.site\.com\/public_html\//http://site\.com/' | firefox
    opens firefox but doesn't seem to pass the URL parameter because it just goes to default (a blank page)

    I don't get it.
    Last edited by betlog; March 21st, 2013 at 01:39 PM.

  3. #3
    Join Date
    Jun 2010
    Beans
    69

    Re: klipper action.. text substitution regex

    As usual, as soon as I forget about it and come back a few days later, why it's failing immediately comes to me:

    firefox "$(echo %s | sed 's/ftp:\/\/username@ftp\.domainname\.domansuffix\/public_html/http:\/\/domainname\.domainsuffix/')"

Tags for this Thread

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •